-
-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
90 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
'use strict'; | ||
const { run } = require('../utils/test-utils'); | ||
const { stat } = require('fs'); | ||
const { resolve } = require('path'); | ||
describe('no-mode flag', () => { | ||
it('should load a development config when --no-mode is passed', done => { | ||
const { stderr, stdout } = run(__dirname, ['--no-mode']); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toBeTruthy(); | ||
stat(resolve(__dirname, './bin/main.js'), (err, stats) => { | ||
expect(err).toBe(null); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should load a development config when --no-mode and --dev are passed', done => { | ||
const { stderr, stdout } = run(__dirname, ['--no-mode', '--dev']); | ||
expect(stderr).toContain('"--dev" will be used'); | ||
expect(stdout).toBeTruthy(); | ||
|
||
stat(resolve(__dirname, './bin/main.js'), (err, stats) => { | ||
expect(err).toBe(null); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should load a production config when --no-mode and --prod are passed', done => { | ||
const { stderr, stdout } = run(__dirname, ['--no-mode', '--prod']); | ||
expect(stderr).toContain('"--prod" will be used'); | ||
expect(stdout).toBeTruthy(); | ||
|
||
stat(resolve(__dirname, './bin/main.js'), (err, stats) => { | ||
expect(err).toBe(null); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should load a production config when --mode=production & --no-mode are passed', done => { | ||
const { stderr, stdout } = run(__dirname, ['--mode', 'production', '--no-mode']); | ||
expect(stderr).toContain('"mode" will be used'); | ||
expect(stdout).toBeTruthy(); | ||
|
||
stat(resolve(__dirname, './bin/main.js'), (err, stats) => { | ||
expect(err).toBe(null); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should load a development config when --mode=development and --no-mode are passed', done => { | ||
const { stderr, stdout } = run(__dirname, ['--mode', 'development', '--no-mode']); | ||
expect(stderr).toContain('"mode" will be used'); | ||
expect(stdout).toBeTruthy(); | ||
|
||
stat(resolve(__dirname, './bin/main.js'), (err, stats) => { | ||
expect(err).toBe(null); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
}); | ||
}); |
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('Test'); |