0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

chore: improve vscode debugging (#969)

* chore: improve vscode debugging

* chore: add functional test settings to vscode
This commit is contained in:
Juan Picado @jotadeveloper 2018-09-03 21:11:52 +02:00 committed by GitHub
parent 5ca0ca5228
commit a5f5004a27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 27 deletions

69
.vscode/launch.json vendored
View file

@ -6,55 +6,72 @@
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"processId": "${command:PickProcess}",
"port": 5858
"request": "launch",
"name": "CLI Babel Registry",
"stopOnEntry": false,
"program": "${workspaceFolder}/debug/bootstrap.js",
"env": {
"BABEL_ENV": "registry"
},
"preLaunchTask": "npm: build:webui",
"console": "integratedTerminal"
},
{
"name": "Tests",
"name": "Unit Tests",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/jest-cli/bin/jest.js",
"stopOnEntry": false,
"args": ["--runInBand"],
"args": [
"--debug=true" ],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"preLaunchTask": "pre-test",
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "test"
"NODE_ENV": "test",
"TZ": "UTC"
},
"externalConsole": false,
"sourceMaps": false,
"outDir": null
"console": "integratedTerminal"
},
{
"name": "Functional Tests",
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceRoot}/node_modules/.bin/jest",
"stopOnEntry": false,
"runtimeExecutable": null,
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
"--no-timeouts",
"${workspaceRoot}/test/unit"
]
"--config",
"./test/jest.config.functional.js",
"--testPathPattern",
"./test/functional/index*",
"--debug=false",
"--verbose",
"--useStderr",
"--detectOpenHandles"],
"cwd": "${workspaceRoot}",
"env": {
"BABEL_ENV": "testOldEnv",
"VERDACCIO_DEBUG": "true",
"VERDACCIO_DEBUG_INJECT": "true",
"NODE_DEBUG": "TO_DEBUG_REQUEST_REMOVE_THIS_request"
},
"preLaunchTask": "pre-test",
"console": "integratedTerminal",
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
},
{
"type": "node",
"request": "launch",
"name": "Verdaccio",
"program": "${workspaceRoot}/bin/verdaccio"
},
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"address": "localhost",
"port": 5858
"name": "Verdaccio Compiled",
"preLaunchTask": "npm: code:build",
"program": "${workspaceRoot}/bin/verdaccio",
"console": "integratedTerminal"
}
]
}

24
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,24 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build:webui",
"problemMatcher": []
},
{
"type": "npm",
"script": "code:build",
"problemMatcher": []
},
{
"label": "pre-test",
"dependsOn": [
"npm: code:build",
"npm: test:clean"
]
}
]
}

View file

@ -157,6 +157,7 @@
"flow": "flow check",
"pretest": "npm run code:build",
"test": "npm run test:unit",
"test:clean": "npx jest --clearCache",
"test:unit": "cross-env NODE_ENV=test BABEL_ENV=test TZ=UTC jest --config ./jest.config.js --maxWorkers 2",
"test:functional": "cross-env NODE_ENV=testOldEnv jest --config ./test/jest.config.functional.js --testPathPattern ./test/functional/index*",
"test:e2e": "cross-env BABEL_ENV=testOldEnv jest --config ./test/jest.config.e2e.js",

View file

@ -77,6 +77,10 @@ class FunctionalEnvironment extends NodeEnvironment {
async teardown() {
await super.teardown();
console.log(chalk.yellow('Teardown Test Environment.'));
if (!this.global.__SERVERS_PROCESS__) {
throw new Error("There are no servers to stop");
}
// shutdown verdaccio
for (let server of this.global.__SERVERS_PROCESS__) {
server[0].stop();