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 bail out behavior if one of the entrypoints does not exist #1165

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/runner/extract-runnable-items.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ var sdk = require('postman-collection'),
// at this point of time, we should have traversed all items mentioned in entrypoint and created a linear
// subset of items. However, if post that, we still have items remaining in lookup object, that implies that
// extra items were present in user input and corresponding items for those do not exist in collection. As such
// we need to bail out if any of the given entry-point is not found.
// we need to bail out with an error if any of the given entry-point is not found.
if (Object.keys(entrypointLookup).length) {
return callback(null, []);
return callback(new Error('Unable to find an entry point'));
}

// extract runnable items from the searched items.
Expand Down
12 changes: 7 additions & 5 deletions test/unit/extract-runnable-items.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,18 @@ describe('extractRunnableItems', function () {
);
});

it('should bail out if any of the given entrypoint is not found. ', function (done) {
it('should bail out with an error if any of the given entrypoint is not found. ', function (done) {
extractRunnableItems(
collection, {
execute: ['ID3', 'RANDOM'],
lookupStrategy: 'multipleIdOrName'
execute: ['RANDOM', 'F1.R1', 'F2.R1'],
lookupStrategy: 'multipleIdOrName',
abortOnError: true
},
function (err, runnableItems, entrypoint) {
expect(err).to.be.null;
expect(runnableItems).to.eql([]);
expect(err.message).to.equal('Unable to find an entry point');
expect(runnableItems).to.be.undefined;
expect(entrypoint).to.be.undefined;

done();
}
);
Expand Down