-
-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make define-process-env-node-env alias node-env (#3514)
* fix: make define-process-env-node-env alias node-env * test: update snapshots * test: update snapshots * fix: add todo
- Loading branch information
1 parent
3ec7b16
commit 346a518
Showing
12 changed files
with
195 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); | ||
|
||
module.exports = { | ||
plugins: [new WebpackCLITestPlugin()], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"use strict"; | ||
|
||
const { run } = require("../../utils/test-utils"); | ||
|
||
describe("--node-env flag", () => { | ||
it('should set "process.env.NODE_ENV" to "development"', async () => { | ||
const { exitCode, stderr, stdout } = await run(__dirname, ["--node-env", "development"]); | ||
|
||
expect(exitCode).toBe(0); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toContain("mode: 'development'"); | ||
}); | ||
|
||
it('should set "process.env.NODE_ENV" to "production"', async () => { | ||
const { exitCode, stderr, stdout } = await run(__dirname, ["--node-env", "production"]); | ||
|
||
expect(exitCode).toBe(0); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toContain("mode: 'production'"); | ||
}); | ||
|
||
it('should set "process.env.NODE_ENV" to "none"', async () => { | ||
const { exitCode, stderr, stdout } = await run(__dirname, ["--node-env", "none"]); | ||
|
||
expect(exitCode).toBe(0); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toContain("mode: 'none'"); | ||
}); | ||
|
||
it('should set "process.env.NODE_ENV" and the "mode" option to "development"', async () => { | ||
const { exitCode, stderr, stdout } = await run(__dirname, [ | ||
"--node-env", | ||
"development", | ||
"--config", | ||
"./auto-mode.config.js", | ||
]); | ||
|
||
expect(exitCode).toBe(0); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toContain("mode: 'development'"); | ||
}); | ||
|
||
it('should set "process.env.NODE_ENV" and the "mode" option to "production"', async () => { | ||
const { exitCode, stderr, stdout } = await run(__dirname, [ | ||
"--node-env", | ||
"production", | ||
"--config", | ||
"./auto-mode.config.js", | ||
]); | ||
|
||
expect(exitCode).toBe(0); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toContain("mode: 'production'"); | ||
}); | ||
|
||
it('should set "process.env.NODE_ENV" and the "mode" option to "none"', async () => { | ||
const { exitCode, stderr, stdout } = await run(__dirname, [ | ||
"--node-env", | ||
"none", | ||
"--config", | ||
"./auto-mode.config.js", | ||
]); | ||
|
||
expect(exitCode).toBe(0); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toContain("mode: 'none'"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('--node-env test'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin"); | ||
|
||
module.exports = { | ||
mode: process.env.NODE_ENV, | ||
plugins: [new WebpackCLITestPlugin()], | ||
}; |
Oops, something went wrong.