Merge pull request #948 from realm/debug-node-tests
enable js debugging of node tests from within vs code
This commit is contained in:
commit
309dfc8733
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible Node.js debug attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Debug Node Unit Tests (rebuild)",
|
||||
"preLaunchTask": "rebuild-node-tests",
|
||||
"cwd": "${workspaceRoot}/tests",
|
||||
"program": "${workspaceRoot}/tests/node_modules/jasmine/bin/jasmine.js",
|
||||
"args": [
|
||||
"spec/unit_tests.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Debug Node Unit Tests",
|
||||
"cwd": "${workspaceRoot}/tests",
|
||||
"program": "${workspaceRoot}/tests/node_modules/jasmine/bin/jasmine.js",
|
||||
"args": [
|
||||
"spec/unit_tests.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Debug Node Sync Unit Tests (rebuild)",
|
||||
"preLaunchTask": "rebuild-node-tests",
|
||||
"cwd": "${workspaceRoot}/tests",
|
||||
"program": "${workspaceRoot}/tests/node_modules/jasmine/bin/jasmine.js",
|
||||
"args": [
|
||||
"spec/sync_tests.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Debug Node Sync Unit Tests",
|
||||
"cwd": "${workspaceRoot}/tests",
|
||||
"program": "${workspaceRoot}/tests/node_modules/jasmine/bin/jasmine.js",
|
||||
"args": [
|
||||
"spec/sync_tests.js"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "0.1.0",
|
||||
"command": "npm",
|
||||
"isShellCommand": true,
|
||||
"showOutput": "always",
|
||||
"suppressTaskName": true,
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "rebuild-node-tests",
|
||||
|
||||
"args": ["run", "prenode-tests"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -56,8 +56,10 @@
|
|||
"license-check": "npm install && license-checker --exclude \"MIT,ISC,BSD,Apache-2.0,BSD-2-Clause,BSD-3-Clause,WTFPL,Unlicense,(MIT AND CC-BY-3.0)\" | node scripts/handle-license-check.js",
|
||||
"jsdoc:clean": "rimraf ./docs/output",
|
||||
"jsdoc": "npm install && npm run jsdoc:clean && jsdoc -c docs/conf.json",
|
||||
"node-tests": "npm install --build-from-source && cd tests && npm install && npm run test-nosync && cd ..",
|
||||
"node-nosync-tests": "npm install --build-from-source && cd tests && npm install && npm run test-nosync && cd ..",
|
||||
"prenode-tests": "npm install --build-from-source && cd tests && npm install",
|
||||
"node-tests": "cd tests && npm run test-nosync && cd ..",
|
||||
"prenode-tests-nosync": "npm install --build-from-source && cd tests && npm install",
|
||||
"node-tests-nosync": "cd tests && npm run test-nosync && cd ..",
|
||||
"test-runner:ava": "cd tests/test-runners/ava && npm install && npm test",
|
||||
"test-runner:mocha": "cd tests/test-runners/mocha && npm install && npm test",
|
||||
"test-runner:jest": "cd tests/test-runners/jest && npm install && npm test",
|
||||
|
|
|
@ -22,7 +22,12 @@
|
|||
|
||||
class Worker {
|
||||
constructor(script, args) {
|
||||
this._process = require('child_process').fork(script, args);
|
||||
let options;
|
||||
if (process.execArgv.find(arg => arg.indexOf("--debug="))) {
|
||||
options = { execArgv: ['--debug=44725'] };
|
||||
}
|
||||
|
||||
this._process = require('child_process').fork(script, args, options);
|
||||
|
||||
this._process.on('message', (message) => {
|
||||
if (this.onmessage) {
|
||||
|
|
Loading…
Reference in New Issue