diff --git a/lib/utils/scenario-manager.js b/lib/utils/scenario-manager.js index f8aeb73b..49ad2579 100644 --- a/lib/utils/scenario-manager.js +++ b/lib/utils/scenario-manager.js @@ -3,17 +3,6 @@ const CoreObject = require('core-object'); module.exports = CoreObject.extend({ - init() { - this._super.apply(this, arguments); - this._checkDependencyManagerAdapters(); - }, - - _checkDependencyManagerAdapters() { - if (!this.dependencyManagerAdapters || this.dependencyManagerAdapters.length === 0) { - throw new Error('No dependency manager adapter'); - } - }, - async setup() { let { ui } = this; diff --git a/test/tasks/try-each-test.js b/test/tasks/try-each-test.js index 2a2f5c2b..cc1b6496 100644 --- a/test/tasks/try-each-test.js +++ b/test/tasks/try-each-test.js @@ -160,6 +160,64 @@ describe('tryEach', () => { }); }); + describe('with no dependency managers', () => { + it('runs properly', async () => { + let config = { + scenarios: [ + { + name: 'first', + command: 'foo-bar', + }, + { + name: 'second', + command: 'baz-qux', + }, + ], + }; + + let steps = []; + let mockedRun = generateMockRun([ + { + command: 'foo-bar', + async callback() { + steps.push('foo-bar ran'); + + return 0; + }, + }, + { + command: 'baz-qux', + async callback() { + steps.push('baz-qux ran'); + + return 0; + }, + }, + ]); + mockery.registerMock('./run', mockedRun); + + let output = []; + let outputFn = function (log) { + output.push(log); + }; + + let TryEachTask = require('../../lib/tasks/try-each'); + let tryEachTask = new TryEachTask({ + ui: { writeLine: outputFn }, + project: { root: tmpdir }, + config, + dependencyManagerAdapters: [], + _on() {}, + }); + + let exitCode = await tryEachTask.run(config.scenarios, {}); + + expect(exitCode).to.equal(0, 'exits 0 when all scenarios succeed'); + expect(output).to.include('Scenario first: SUCCESS'); + expect(steps).to.deep.equal(['foo-bar ran', 'baz-qux ran']); + }); + }); + describe('with stubbed dependency manager', () => { it('passes along timeout options to run', function () { // With stubbed dependency manager, timing out is warning for accidentally not using the stub diff --git a/test/utils/scenario-manager-test.js b/test/utils/scenario-manager-test.js index 3659216d..8e23dac5 100644 --- a/test/utils/scenario-manager-test.js +++ b/test/utils/scenario-manager-test.js @@ -6,6 +6,10 @@ const CoreObject = require('core-object'); const RSVP = require('rsvp'); describe('scenarioManager', () => { + it('does not require any dependency managers', () => { + new ScenarioManager({ dependencyManagerAdapters: [] }); + }); + describe('#setup', () => { it('sets up each of the dependency managers', () => { let calledFirstAdapter = false;