git commit add test for package.json config
This commit is contained in:
@@ -156,7 +156,7 @@ suite("buildConfigChain", function () {
|
||||
|
||||
test("env - foo", function () {
|
||||
process.env.NODE_ENV = "foo";
|
||||
|
||||
|
||||
var chain = buildConfigChain({
|
||||
filename: fixture("env", "src.js")
|
||||
});
|
||||
@@ -204,11 +204,11 @@ suite("buildConfigChain", function () {
|
||||
|
||||
assert.deepEqual(chain, expected);
|
||||
});
|
||||
|
||||
|
||||
test("env - bar", function () {
|
||||
process.env.NODE_ENV = "foo"; // overridden
|
||||
process.env.NODE_ENV = "bar";
|
||||
|
||||
|
||||
var chain = buildConfigChain({
|
||||
filename: fixture("env", "src.js")
|
||||
});
|
||||
@@ -256,4 +256,42 @@ suite("buildConfigChain", function () {
|
||||
|
||||
assert.deepEqual(chain, expected);
|
||||
});
|
||||
|
||||
|
||||
test("env - foo", function () {
|
||||
process.env.NODE_ENV = "foo";
|
||||
|
||||
var chain = buildConfigChain({
|
||||
filename: fixture("pkg", "src.js")
|
||||
});
|
||||
|
||||
var expected = [
|
||||
{
|
||||
options: {
|
||||
plugins: ["pkg-plugin"]
|
||||
},
|
||||
alias: fixture("pkg", "package.json"),
|
||||
loc: fixture("pkg", "package.json"),
|
||||
dirname: fixture("pkg")
|
||||
},
|
||||
{
|
||||
options: {
|
||||
ignore: ["pkg-ignore"]
|
||||
},
|
||||
alias: fixture("pkg", ".babelignore"),
|
||||
loc: fixture("pkg", ".babelignore"),
|
||||
dirname: fixture("pkg")
|
||||
},
|
||||
{
|
||||
options: {
|
||||
filename: fixture("pkg", "src.js")
|
||||
},
|
||||
alias: "base",
|
||||
loc: "base",
|
||||
dirname: fixture("pkg")
|
||||
}
|
||||
];
|
||||
|
||||
assert.deepEqual(chain, expected);
|
||||
});
|
||||
});
|
||||
|
||||
1
packages/babel-core/test/fixtures/config/pkg/.babelignore
vendored
Normal file
1
packages/babel-core/test/fixtures/config/pkg/.babelignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
pkg-ignore
|
||||
7
packages/babel-core/test/fixtures/config/pkg/package.json
vendored
Normal file
7
packages/babel-core/test/fixtures/config/pkg/package.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "application-name",
|
||||
"version": "0.0.1",
|
||||
"babel": {
|
||||
"plugins": ["pkg-plugin"]
|
||||
}
|
||||
}
|
||||
1
packages/babel-core/test/fixtures/config/pkg/src.js
vendored
Normal file
1
packages/babel-core/test/fixtures/config/pkg/src.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
// empty
|
||||
Reference in New Issue
Block a user