Skip to content

Commit

Permalink
Merge pull request #1320 from stealjs/buildconfig
Browse files Browse the repository at this point in the history
Prevents buildConfig from overriding package's configuration
  • Loading branch information
matthewp authored Jan 10, 2018
2 parents b309bed + 634de88 commit 93856cc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/npm-convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function convertSteal(context, pkg, steal, root, ignoreWaiting, resavePackageInf
// needed for builds
if(steal.buildConfig) {
steal.buildConfig = convertSteal(context, pkg, steal.buildConfig,
root, waiting);
root, waiting, false);
}

// Push the waiting conversions down.
Expand Down
40 changes: 40 additions & 0 deletions test/npm/normalize_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,3 +876,43 @@ QUnit.test("'map' configuration where the right-hand identifier is an npm packag
.then(done, helpers.fail(assert, done));
});

QUnit.test("buildConfig that is late-loaded doesn't override outer config", function(assert){
var done = assert.async();

var loader = helpers.clone()
.rootPackage({
name: "app",
main: "main.js",
version: "1.0.0",
dependencies: {
dep: "1.0.0"
},
steal: {
map: {
"app/one": "app/two"
},
buildConfig: {
map: {
"app/one": "dep"
}
}
}
})
.withPackages([
{
name: "dep",
main: "main.js",
version: "1.0.0"
}
])
.loader;

helpers.init(loader).then(function(){
loader.npmContext.resavePackageInfo = true;
return loader.normalize("dep", "[email protected]#main");
}).then(function(){
var pkg = loader.npmContext.pkgInfo[0];
assert.equal(pkg.steal.map["[email protected]#one"], "[email protected]#two", "Correct mapping in place");
})
.then(done, helpers.fail(assert, done));
});

0 comments on commit 93856cc

Please sign in to comment.