Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove requirement to have dependency managers. #143

Merged
merged 2 commits into from Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 0 additions & 11 deletions lib/utils/scenario-manager.js
Expand Up @@ -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;

Expand Down
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
4 changes: 4 additions & 0 deletions test/utils/scenario-manager-test.js
Expand Up @@ -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;
Expand Down