-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into snapshot-resolver
- Loading branch information
Showing
76 changed files
with
396 additions
and
318 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
28 changes: 28 additions & 0 deletions
28
integration-tests/__tests__/__snapshots__/detect_open_handles.js.snap
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 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`prints message about flag on forceExit 1`] = ` | ||
"Force exiting Jest | ||
Have you considered using \`--detectOpenHandles\` to detect async operations that kept running after all tests finished?" | ||
`; | ||
|
||
exports[`prints message about flag on slow tests 1`] = ` | ||
"Jest did not exit one second after the test run has completed. | ||
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with \`--detectOpenHandles\` to troubleshoot this issue." | ||
`; | ||
|
||
exports[`prints out info about open handlers 1`] = ` | ||
"Jest has detected the following 1 open handle potentially keeping Jest from exiting: | ||
● GETADDRINFOREQWRAP | ||
5 | const app = new http.Server(); | ||
6 | | ||
> 7 | app.listen({host: 'localhost', port: 0}); | ||
| ^ | ||
8 | | ||
at Object.<anonymous> (server.js:7:5) | ||
at Object.<anonymous> (__tests__/test.js:3:1)" | ||
`; |
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,62 @@ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
'use strict'; | ||
|
||
const runJest = require('../runJest'); | ||
|
||
try { | ||
// $FlowFixMe: Node core | ||
require('async_hooks'); | ||
} catch (e) { | ||
if (e.code === 'MODULE_NOT_FOUND') { | ||
// eslint-disable-next-line jest/no-focused-tests | ||
fit('skip test for unsupported nodes', () => { | ||
console.warn('Skipping test for node ' + process.version); | ||
}); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
|
||
function getTextAfterTest(stderr) { | ||
return stderr.split('Ran all test suites.')[1].trim(); | ||
} | ||
|
||
it('prints message about flag on slow tests', async () => { | ||
const {stderr} = await runJest.until( | ||
'detect-open-handles', | ||
[], | ||
'Jest did not exit one second after the test run has completed.', | ||
); | ||
const textAfterTest = getTextAfterTest(stderr); | ||
|
||
expect(textAfterTest).toMatchSnapshot(); | ||
}); | ||
|
||
it('prints message about flag on forceExit', async () => { | ||
const {stderr} = await runJest.until( | ||
'detect-open-handles', | ||
['--forceExit'], | ||
'Force exiting Jest', | ||
); | ||
const textAfterTest = getTextAfterTest(stderr); | ||
|
||
expect(textAfterTest).toMatchSnapshot(); | ||
}); | ||
|
||
it('prints out info about open handlers', async () => { | ||
const {stderr} = await runJest.until( | ||
'detect-open-handles', | ||
['--detectOpenHandles'], | ||
'Jest has detected', | ||
); | ||
const textAfterTest = getTextAfterTest(stderr); | ||
|
||
expect(textAfterTest).toMatchSnapshot(); | ||
}); |
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 @@ | ||
require('../server'); | ||
|
||
test('something', () => { | ||
expect(true).toBe(true); | ||
}); |
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 @@ | ||
{ | ||
"jest": { | ||
"testEnvironment": "node" | ||
} | ||
} |
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,7 @@ | ||
'use strict'; | ||
|
||
const http = require('http'); | ||
|
||
const app = new http.Server(); | ||
|
||
app.listen({host: 'localhost', port: 0}); |
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
Oops, something went wrong.