diff --git a/src/__tests__/__snapshots__/conditional.spec.ts.snap b/src/__tests__/__snapshots__/conditional.spec.ts.snap index ecd1c3c..d4fa456 100644 --- a/src/__tests__/__snapshots__/conditional.spec.ts.snap +++ b/src/__tests__/__snapshots__/conditional.spec.ts.snap @@ -264,6 +264,8 @@ exports[`buildkite-graph Steps Command isEffectOf later steps affect earlier eff "* * [wait] * +* [wait] +* * " `; diff --git a/src/__tests__/conditional.spec.ts b/src/__tests__/conditional.spec.ts index 91ecadb..ed4774f 100644 --- a/src/__tests__/conditional.spec.ts +++ b/src/__tests__/conditional.spec.ts @@ -333,28 +333,41 @@ describe('buildkite-graph', () => { createTest( 'later steps affect earlier effects', () => { + const p = new Pipeline('x'); const buildConditional = new MyConditional( - new CommandStep('build app'), + () => new CommandStep('build app'), false, ); + p.add(buildConditional); const deployApp = new CommandStep( 'deploy app', ).isEffectOf(buildConditional); + p.add(deployApp); + + const releaseApp = new CommandStep( + 'release app', + ).isEffectOf(deployApp); + p.add(releaseApp); const tests = new MyConditional( () => - new CommandStep( - 'run integration tests', - ).dependsOn(buildConditional), + new Promise(resolve => + setTimeout( + () => + resolve( + new CommandStep( + 'run integration tests', + ).dependsOn(buildConditional), + ), + 100, + ), + ), true, ); + p.add(tests); - return new Pipeline('x').add( - buildConditional, - deployApp, - tests, - ); + return p; }, ['structure'], ); diff --git a/src/sortedSteps.ts b/src/sortedSteps.ts index 2f250c5..5435333 100644 --- a/src/sortedSteps.ts +++ b/src/sortedSteps.ts @@ -116,14 +116,8 @@ export async function sortedSteps( ); addDependency(dependency); for (const removedEffectStep of removedEffects) { - if ( - removedEffectStep.effectDependencies.has( - potentialDependency, - ) - ) { - removedEffects.delete(removedEffectStep); - await iterateAndAddEffect(removedEffectStep); - } + removedEffects.delete(removedEffectStep); + await iterateAndAddEffect(removedEffectStep); } } }