-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fixes #860: failure to exit on SIGINT race condition * correct test name * increase test timeout
- Loading branch information
1 parent
3d72858
commit 0a8f896
Showing
4 changed files
with
52 additions
and
5 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,28 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const path = require('path'); | ||
const execa = require('execa'); | ||
|
||
describe('SIGINT', () => { | ||
it('should exit the process when SIGINT is detected', (done) => { | ||
const cliPath = path.resolve(__dirname, '../bin/webpack-dev-server.js'); | ||
const examplePath = path.resolve(__dirname, '../examples/cli-public'); | ||
const nodePath = execa.shellSync('which node').stdout; | ||
|
||
const proc = execa(nodePath, [cliPath], { cwd: examplePath }); | ||
|
||
proc.stdout.on('data', (data) => { | ||
const bits = data.toString(); | ||
|
||
if (/webpack: Compiled successfully/.test(bits)) { | ||
assert(proc.pid !== 0); | ||
proc.kill('SIGINT'); | ||
} | ||
}); | ||
|
||
proc.on('exit', () => { | ||
done(); | ||
}); | ||
}).timeout(4000); | ||
}); |