Skip to content

Commit

Permalink
Add test for no dependency managers.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Nov 2, 2020
1 parent d4d0a13 commit 2157e49
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions test/tasks/try-each-test.js
Expand Up @@ -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
Expand Down

0 comments on commit 2157e49

Please sign in to comment.