https://github.com/nfour/jest-inspect-hooks
https://github.com/nfour/jest-inspect-hooks
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/nfour/jest-inspect-hooks
- Owner: nfour
- Created: 2018-09-21T04:50:27.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-21T04:57:29.000Z (almost 8 years ago)
- Last Synced: 2024-10-11T23:12:53.581Z (almost 2 years ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Jest Inspect Hooks
## Usage
In your `jest.config.js`:
```ts
module.exports = {
// (Required) Ensures the use of the original `global.console`
testEnvironment: "jest-inspect-hooks/testEnvironment/NodeEnvironment",
// (Required) Ensures the use of the original `global.console`
setupTestFrameworkScriptFile: "jest-inspect-hooks/setupTestFrameworkScriptFile",
// (Optional) This will place a `debugger` statement at test completion
// This allows you to inspect `console` logs before terminating the process
globalTeardown: "jest-inspect-hooks/globalTeardown",
}
```
## VSCode
Try this launch.json:
```json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "Jest Inspect",
"request": "launch",
"protocol": "inspector",
"args": [ "--runInBand" ],
"console": "internalConsole",
"autoAttachChildProcesses": true,
"smartStep": true,
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
]
}
```
## Environments
There are a few environments supplied. These require the respective peer dependency to work, though.
```ts
module.exports = {
testEnvironment: "jest-inspect-hooks/testEnvironment/NodeEnvironment",
testEnvironment: "jest-inspect-hooks/testEnvironment/JsdomEnvironment",
}
```