Skip to content

Commit 18bcade

Browse files
author
Kelly Selden
committed
assert common error, two layers of base blueprints
1 parent db4dbee commit 18bcade

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/get-start-and-end-commands.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ module.exports = function getStartAndEndCommands({
2121
startBlueprint,
2222
endBlueprint
2323
}) {
24+
if (endBlueprint.isBaseBlueprint && baseBlueprint) {
25+
throw new Error('You supplied two layers of base blueprints.');
26+
}
27+
2428
let startRange;
2529
let endRange;
2630
if (isDefaultBlueprint(endBlueprint)) {

test/unit/get-start-and-end-commands-test.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ describe(_getStartAndEndCommands, function() {
5050
function getStartAndEndCommands(options) {
5151
return _getStartAndEndCommands(Object.assign({
5252
packageJson: { name: projectName },
53-
baseBlueprint,
5453
startBlueprint: defaultStartBlueprint,
5554
endBlueprint: defaultEndBlueprint
5655
}, options));
5756
}
5857

58+
it('throws if two layers of base blueprints', function() {
59+
let f = () => getStartAndEndCommands({
60+
baseBlueprint
61+
});
62+
63+
expect(f).to.throw('You supplied two layers of base blueprints.');
64+
});
65+
5966
it('returns an options object', function() {
6067
let options = getStartAndEndCommands();
6168

@@ -70,12 +77,12 @@ describe(_getStartAndEndCommands, function() {
7077
packageName,
7178
commandName,
7279
startOptions: {
73-
baseBlueprint,
80+
baseBlueprint: undefined,
7481
blueprint: defaultStartBlueprint,
7582
packageRange: startVersion
7683
},
7784
endOptions: {
78-
baseBlueprint,
85+
baseBlueprint: undefined,
7986
blueprint: defaultEndBlueprint,
8087
packageRange: endVersion
8188
}
@@ -260,6 +267,7 @@ describe(_getStartAndEndCommands, function() {
260267
describe('custom blueprint', function() {
261268
it('returns an options object', async function() {
262269
let options = getStartAndEndCommands({
270+
baseBlueprint,
263271
startBlueprint: {
264272
name: blueprint,
265273
version: startVersion
@@ -639,12 +647,12 @@ describe(_getStartAndEndCommands, function() {
639647
packageName,
640648
commandName,
641649
startOptions: {
642-
baseBlueprint,
650+
baseBlueprint: undefined,
643651
blueprint: null,
644652
packageRange: null
645653
},
646654
endOptions: {
647-
baseBlueprint,
655+
baseBlueprint: undefined,
648656
blueprint: defaultEndBlueprint,
649657
packageRange: endVersion
650658
}
@@ -653,6 +661,7 @@ describe(_getStartAndEndCommands, function() {
653661

654662
it('returns an options object - custom', async function() {
655663
let options = getStartAndEndCommands({
664+
baseBlueprint,
656665
startBlueprint: null,
657666
endBlueprint: {
658667
name: blueprint,

0 commit comments

Comments
 (0)