mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
0349c6ba16
* docs: add tests/jest.md debugging guide * docs:jest.md: add basic test command * README.md: add docs/tests/jest.md link
2.0 KiB
2.0 KiB
Getting Started
Running a Jest test
> yarn jest <path>
Debugging
Debugging Jest in VS Code
-
Open VS Code
-
Open the “Run and Debug” panel (⇧⌘D)
-
Click the “JavaScript Debug Terminal” button to open the Terminal
-
Run Jest using Node
> yarn jest --watch <path>
Additional methods and information to debug in VS Code can be found here
Debugging Jest on Chrome DevTools
-
Run Jest using Node with the V8 Inspector
> node --inspect ./node_modules/.bin/jest --watch -i <path> or > node --inspect ./node_modules/.bin/jest <path>
Options:
node: --inspect=[host:]port Activate inspector on host:port. Default is 127.0.0.1:9229. V8 Inspector integration allows attaching Chrome DevTools and IDEs to Node.js instances for debugging and profiling. It uses the Chrome DevTools Protocol. jest: --watch Watch files for changes and rerun tests related to changed files. If you want to re-run all tests when a file has changed, use the `--watchAll` option. [boolean] -i, --runInBand Run all tests serially in the current process (rather than creating a worker pool of child processes that run tests). This is sometimes useful for debugging, but such use cases are pretty rare. [boolean]
-
Open Chrome DevTools for Node
- Open a Chromium browser
- Go to chrome://inspect/#devices
- Click “Open dedicated DevTools for Node” link