diff --git a/.vscode/launch.json b/.vscode/launch.json index 93f883216..e8d07e068 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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" + "--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" } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..ef81696e0 --- /dev/null +++ b/.vscode/tasks.json @@ -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" + ] + } + ] +} \ No newline at end of file diff --git a/package.json b/package.json index ad7932d5f..0b2ebbf91 100644 --- a/package.json +++ b/package.json @@ -161,6 +161,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", diff --git a/test/functional/lib/environment.js b/test/functional/lib/environment.js index 4a6dccb72..0f843a39a 100644 --- a/test/functional/lib/environment.js +++ b/test/functional/lib/environment.js @@ -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();