Skip to content

Commit 8230848

Browse files
author
Simen Brekken
committed
Added EnvPlugin tests.
1 parent b80edb6 commit 8230848

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
it("should import a single process.env var", function() {
2+
process.env.AAA.should.be.eql("aaa");
3+
});
4+
5+
it("should import multiple process.env vars", function() {
6+
process.env.BBB.should.be.eql("bbb");
7+
process.env.CCC.should.be.eql("123");
8+
});
9+
10+
it("should warn when a process.env variable is undefined", function() {
11+
(process.env.DDD === undefined).should.be.true;
12+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = [
2+
[/DDD/, /environment variable is undefined/]
3+
];
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var EnvPlugin = require("../../../../lib/EnvPlugin");
2+
process.env.AAA = "aaa";
3+
process.env.BBB = "bbb";
4+
process.env.CCC = "123";
5+
module.exports = [{
6+
plugins: [
7+
new EnvPlugin("AAA")
8+
]
9+
}, {
10+
plugins: [
11+
new EnvPlugin("BBB", "CCC")
12+
]
13+
}, {
14+
plugins: [
15+
new EnvPlugin("DDD")
16+
]
17+
}];

0 commit comments

Comments
 (0)