@factorialco/shadowdog
Version:
<img src="https://raw.githubusercontent.com/factorialco/shadowdog/refs/heads/main/logo.png" alt="drawing" width="100"/>
210 lines (209 loc) • 6.58 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const shadowdog_rake_1 = __importDefault(require("./shadowdog-rake"));
(0, vitest_1.it)('shadowdog rake joins rake tasks from the same working directory', () => {
const task = {
type: 'parallel',
tasks: [
{
type: 'command',
config: {
command: 'bundle exec rake first',
artifacts: [],
tags: [],
workingDirectory: 'backend',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
{
type: 'command',
config: {
command: 'echo non rake task',
artifacts: [],
tags: [],
workingDirectory: 'backend',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
{
type: 'command',
config: {
command: 'bundle exec rake second',
artifacts: [],
tags: [],
workingDirectory: 'backend',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
],
};
(0, vitest_1.expect)(shadowdog_rake_1.default.command(task)).toEqual({
type: 'parallel',
tasks: [
{
type: 'command',
config: {
command: 'echo non rake task',
artifacts: [],
tags: [],
workingDirectory: 'backend',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
{
type: 'parallel',
tasks: [
{
type: 'command',
config: {
command: 'bundle exec rake first second',
artifacts: [],
tags: [],
workingDirectory: 'backend',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
],
},
],
});
});
(0, vitest_1.it)('shadowdog rake joins rake tasks from different working directories', () => {
const task = {
type: 'parallel',
tasks: [
{
type: 'command',
config: {
command: 'bundle exec rake first',
artifacts: [],
tags: [],
workingDirectory: 'backend',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
{
type: 'command',
config: {
command: 'bundle exec rake third',
artifacts: [],
tags: [],
workingDirectory: 'graphql-server',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
{
type: 'command',
config: {
command: 'echo non rake task',
artifacts: [],
tags: [],
workingDirectory: 'backend',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
{
type: 'command',
config: {
command: 'bundle exec rake second',
artifacts: [],
tags: [],
workingDirectory: 'backend',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
],
};
(0, vitest_1.expect)(shadowdog_rake_1.default.command(task)).toEqual({
type: 'parallel',
tasks: [
{
type: 'command',
config: {
command: 'echo non rake task',
artifacts: [],
tags: [],
workingDirectory: 'backend',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
{
type: 'parallel',
tasks: [
{
type: 'command',
config: {
command: 'bundle exec rake first second',
artifacts: [],
tags: [],
workingDirectory: 'backend',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
{
type: 'command',
config: {
command: 'bundle exec rake third',
artifacts: [],
tags: [],
workingDirectory: 'graphql-server',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
],
},
],
});
});