Skip to content

Commit dd22b7d

Browse files
author
Raman Aleksandrovich
committed
Bail out with an error, if non-existent entry point is provided
For lookupStrategy "multipleIdOrName", we should bail out wit an error if one of the provided entrypoints does not exist.
1 parent 09e11bc commit dd22b7d

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/runner/extract-runnable-items.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ var sdk = require('postman-collection'),
198198
// at this point of time, we should have traversed all items mentioned in entrypoint and created a linear
199199
// subset of items. However, if post that, we still have items remaining in lookup object, that implies that
200200
// extra items were present in user input and corresponding items for those do not exist in collection. As such
201-
// we need to bail out if any of the given entry-point is not found.
201+
// we need to bail out with an error if any of the given entry-point is not found.
202202
if (Object.keys(entrypointLookup).length) {
203-
return callback(null, []);
203+
return callback(new Error('Unable to find an entry point'));
204204
}
205205

206206
// extract runnable items from the searched items.

test/unit/extract-runnable-items.test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,18 @@ describe('extractRunnableItems', function () {
275275
);
276276
});
277277

278-
it('should bail out if any of the given entrypoint is not found. ', function (done) {
278+
it('should bail out with an error if any of the given entrypoint is not found. ', function (done) {
279279
extractRunnableItems(
280280
collection, {
281-
execute: ['ID3', 'RANDOM'],
282-
lookupStrategy: 'multipleIdOrName'
281+
execute: ['RANDOM', 'F1.R1', 'F2.R1'],
282+
lookupStrategy: 'multipleIdOrName',
283+
abortOnError: true
283284
},
284285
function (err, runnableItems, entrypoint) {
285-
expect(err).to.be.null;
286-
expect(runnableItems).to.eql([]);
286+
expect(err.message).to.equal('Unable to find an entry point');
287+
expect(runnableItems).to.be.undefined;
287288
expect(entrypoint).to.be.undefined;
289+
288290
done();
289291
}
290292
);

0 commit comments

Comments
 (0)