An open API service indexing awesome lists of open source software.

https://github.com/nfour/jest-inspect-hooks


https://github.com/nfour/jest-inspect-hooks

Last synced: over 1 year ago
JSON representation

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",
}
```