Add test:debug target

Summary:
To run a test with the chrome debugger attached:
* Add `debugger` statement in the code
* Open 'chrome://inspect' and then "Open dedicated DevTools for Node"
* run `yarn test:debug $TEST_FILE` where $TEST_FILE is the file containing the tests to debug

I haven't done this for test-electron and test-with-device because the debugger didn't hit the breakpoint for some reason. Shipping this because some is better than all.

Reviewed By: danielbuechele

Differential Revision: D14457843

fbshipit-source-id: 3ce7ba7a95f4623bd87b5feeae0c26a65f4b7eb8
This commit is contained in:
John Knox
2019-03-14 11:01:32 -07:00
committed by Facebook Github Bot
parent f8b86362d7
commit b675d1c6b5

View File

@@ -132,6 +132,7 @@
"build-headless": "yarn rm-dist && mkdir dist && cross-env NODE_ENV=production node scripts/build-headless.js $@", "build-headless": "yarn rm-dist && mkdir dist && cross-env NODE_ENV=production node scripts/build-headless.js $@",
"fix": "eslint . --fix", "fix": "eslint . --fix",
"test": "jest --testPathPattern=node\\.js$ --no-cache", "test": "jest --testPathPattern=node\\.js$ --no-cache",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand",
"test-electron": "jest --testPathPattern=electron\\.js$ --testEnvironment=@jest-runner/electron/environment --runner=@jest-runner/electron --no-cache", "test-electron": "jest --testPathPattern=electron\\.js$ --testEnvironment=@jest-runner/electron/environment --runner=@jest-runner/electron --no-cache",
"test-with-device": "USE_ELECTRON_STUBS=1 jest --testPathPattern=device\\.js$ --detectOpenHandles --forceExit --no-cache", "test-with-device": "USE_ELECTRON_STUBS=1 jest --testPathPattern=device\\.js$ --detectOpenHandles --forceExit --no-cache",
"lint": "eslint . && flow check" "lint": "eslint . && flow check"