@factorialco/shadowdog
Version:
<img src="https://raw.githubusercontent.com/factorialco/shadowdog/refs/heads/main/logo.png" alt="drawing" width="100"/>
143 lines (142 loc) • 4.64 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_tree_1 = __importDefault(require("./shadowdog-tree"));
(0, vitest_1.it)('shadowdog tree organize tasks with dependencies in serial tasks', () => {
const task = {
type: 'parallel',
tasks: [
{
type: 'command',
config: {
command: 'echo first',
artifacts: [
{
output: 'first.artifact',
},
],
tags: [],
workingDirectory: '',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
{
type: 'command',
config: {
command: 'echo second',
artifacts: [
{
output: 'second.artifact',
},
],
tags: [],
workingDirectory: '',
},
files: ['first.artifact'],
invalidators: {
environment: [],
files: [],
},
},
{
type: 'command',
config: {
command: 'echo third',
artifacts: [
{
output: 'third.artifact',
},
],
tags: [],
workingDirectory: '',
},
files: ['second.artifact'],
invalidators: {
environment: [],
files: [],
},
},
],
};
(0, vitest_1.expect)(shadowdog_tree_1.default.command(task)).toEqual({
type: 'serial',
tasks: [
{
type: 'parallel',
tasks: [
{
type: 'command',
config: {
command: 'echo first',
artifacts: [
{
output: 'first.artifact',
},
],
tags: [],
workingDirectory: '',
},
files: [],
invalidators: {
environment: [],
files: [],
},
},
],
},
{
type: 'parallel',
tasks: [
{
type: 'command',
config: {
command: 'echo second',
artifacts: [
{
output: 'second.artifact',
},
],
tags: [],
workingDirectory: '',
},
files: ['first.artifact'],
invalidators: {
environment: [],
files: [],
},
},
],
},
{
type: 'parallel',
tasks: [
{
type: 'command',
config: {
command: 'echo third',
artifacts: [
{
output: 'third.artifact',
},
],
tags: [],
workingDirectory: '',
},
files: ['second.artifact'],
invalidators: {
environment: [],
files: [],
},
},
],
},
],
});
});