feat: add vscode tasks for running tests and debugger

Closes #2666
This commit is contained in:
Ben Bangert 2019-10-01 15:52:02 -07:00
Родитель da8f72355b
Коммит dac5e8b988
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 340D6D716D25CCA6
23 изменённых файлов: 5505 добавлений и 16 удалений

Просмотреть файл

@ -1,10 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
title: ""
labels: ""
assignees: ""
---
## Description

22
.vscode/extensions.json поставляемый
Просмотреть файл

@ -1,12 +1,14 @@
{
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin",
"rbbit.typescript-hero",
"waderyan.nodejs-extension-pack",
"esbenp.prettier-vscode",
"rust-lang.rust",
"ms-azuretools.vscode-docker",
"ms-vsliveshare.vsliveshare",
"github.vscode-pull-request-github"
]
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin",
"rbbit.typescript-hero",
"waderyan.nodejs-extension-pack",
"esbenp.prettier-vscode",
"rust-lang.rust",
"ms-azuretools.vscode-docker",
"ms-vsliveshare.vsliveshare",
"github.vscode-pull-request-github",
"bierner.github-markdown-preview",
"alex-young.pm2-explorer"
]
}

40
packages/fxa-auth-db-mysql/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,40 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/test/local",
"${workspaceFolder}/test/mem",
"${workspaceFolder}/test/backend",
"${workspaceFolder}/db-server/test/local"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"preLaunchTask": "Stop PM2 Auth Db Server",
"postDebugTask": "Start PM2 Auth Db Server"
},
{
"type": "node",
"request": "launch",
"name": "Mocha Current File",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/${relativeFile}"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"preLaunchTask": "Stop PM2 Auth Db Server",
"postDebugTask": "Start PM2 Auth Db Server"
}
]
}

50
packages/fxa-auth-db-mysql/.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,50 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Current Auth Db MySQL Local Test",
"type": "shell",
"command": "./scripts/mocha-coverage.js",
"args": [
"-R",
"dot",
"--recursive",
"--timeout",
"5000",
"--exit",
"${relativeFile}"
],
"group": "test",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
},
"options": {
"env": {
"NODE_ENV": "dev",
"VERIFIER_VERSION": "0",
"NO_COVERAGE": "1",
"CORS_ORIGIN": "http://foo,http://bar"
}
}
},
{
"label": "DB Patcher",
"type": "shell",
"command": "node ./bin/db_patcher.js >/dev/null",
},
{
"label": "Stop PM2 Auth Db Server",
"type": "shell",
"command": "pm2 stop 'auth-server db mysql PORT 8000'",
"dependsOn": "DB Patcher"
},
{
"label": "Start PM2 Auth Db Server",
"type": "shell",
"command": "pm2 start 'auth-server db mysql PORT 8000'"
}
],
}

49
packages/fxa-auth-server/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,49 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/test/local"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": {
"NODE_ENV": "dev",
"VERIFIER_VERSION": "0",
"NO_COVERAGE": "1",
"CORS_ORIGIN": "http://foo,http://bar"
},
"preLaunchTask": "Stop PM2 Auth Server",
"postDebugTask": "Start PM2 Auth Server"
},
{
"type": "node",
"request": "launch",
"name": "Mocha Current File",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/${relativeFile}"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": {
"NODE_ENV": "dev",
"VERIFIER_VERSION": "0",
"NO_COVERAGE": "1",
"CORS_ORIGIN": "http://foo,http://bar"
},
"preLaunchTask": "Stop PM2 Auth Server",
"postDebugTask": "Start PM2 Auth Server"
}
]
}

44
packages/fxa-auth-server/.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,44 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Current AuthServer Local Test",
"type": "shell",
"command": "./scripts/mocha-coverage.js",
"args": [
"-R",
"dot",
"--recursive",
"--timeout",
"5000",
"--exit",
"${relativeFile}"
],
"group": "test",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
},
"options": {
"env": {
"NODE_ENV": "dev",
"VERIFIER_VERSION": "0",
"NO_COVERAGE": "1",
"CORS_ORIGIN": "http://foo,http://bar"
}
}
},
{
"label": "Stop PM2 Auth Server",
"type": "shell",
"command": "pm2 stop 'auth-server key server PORT 9000'"
},
{
"label": "Start PM2 Auth Server",
"type": "shell",
"command": "pm2 start 'auth-server key server PORT 9000'"
}
]
}

Просмотреть файл

@ -63,6 +63,15 @@ To change the default auth server edit `server/config/*.json` on your deployed i
**Note that testing with Selenium via Docker does _not_ work at present, so all testing must be carried out via your normal operating system's npm & Java tooling.**
#### Using xvfb
On headless systems that can't spawn Firefox for use with Selenium, `xvfb-run` may be used for a virtual framebuffer for Firefox
to run with. After installing `xvfb-run` the functional tests can be run with:
```sh
xvfb-run -s "-screen 0 1920x1200x16" npm run test-functional
```
### Unit Tests
If you want to test only the unit tests (not Selenium/function tests) you can visit http://127.0.0.1:3030/tests/index.html and you can select specific tests with something like http://127.0.0.1:3030/tests/index.html?grep=fxa-client

13
packages/fxa-customs-server/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Tap current file",
"program": "${workspaceFolder}/${relativeFile}",
"cwd": "${workspaceFolder}",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

20
packages/fxa-customs-server/.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,20 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run Current Test",
"type": "shell",
"command": "./node_modules/tap/bin/run.js",
"args": [
"${relativeFile}"
],
"group": "test",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
}
}
]
}

39
packages/fxa-email-event-proxy/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,39 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"--recursive",
"${workspaceFolder}/tests"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Mocha Current File",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"--recursive",
"${workspaceFolder}/${relativeFile}"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}

0
packages/fxa-email-event-proxy/.vscode/tasks.json поставляемый Normal file
Просмотреть файл

63
packages/fxa-event-broker/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,63 @@
{
// 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": "Local Nodemon",
"preLaunchTask": "tsc-watch",
"protocol": "auto",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "debug"],
"restart": true,
"port": 5858,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
},
{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"-r",
"ts-node/register",
"${workspaceFolder}/test/**/*.spec.ts",
"${workspaceFolder}/test/**/**/*.spec.ts"
],
"env": {
"FIRESTORE_EMULATOR_HOST": "localhost:8006",
"FIRESTORE_PROJECT_ID": "fx-event-broker"
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Mocha Current File",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"-r",
"ts-node/register",
"${workspaceFolder}/${relativeFile}"
],
"env": {
"FIRESTORE_EMULATOR_HOST": "localhost:8006",
"FIRESTORE_PROJECT_ID": "fx-event-broker"
},
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}

36
packages/fxa-event-broker/.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,36 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "tsc-watch",
"command": "npm",
"args": ["run", "watch"],
"type": "shell",
"isBackground": true,
"group": "build",
"problemMatcher": "$tsc-watch",
"presentation": {
"reveal": "always"
}
},
{
"label": "Run Current Test",
"type": "shell",
"command": "./node_modules/mocha/bin/mocha",
"options": {
"env": {
"FIRESTORE_EMULATOR_HOST": "localhost:8006",
"FIRESTORE_PROJECT_ID": "fx-event-broker"
}
},
"args": ["-r", "ts-node/register", "${relativeFile}"],
"group": "test",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
}
}
]
}

2505
packages/fxa-event-broker/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -10,7 +10,8 @@
"watch": "tsc -w",
"test": "FIRESTORE_EMULATOR_HOST=localhost:8006 FIRESTORE_PROJECT_ID=fx-event-broker ./node_modules/mocha/bin/mocha -r ts-node/register test/**/*.spec.ts test/**/**/*.spec.ts",
"start": "npm run build && node ./dist/bin/worker.js",
"start-dev": "npm run build && NODE_ENV=development PUBSUB_EMULATOR_HOST=localhost:8005 FIRESTORE_EMULATOR_HOST=localhost:8006 node ./dist/bin/workerDev.js"
"start-dev": "npm run build && NODE_ENV=development PUBSUB_EMULATOR_HOST=localhost:8005 FIRESTORE_EMULATOR_HOST=localhost:8006 node ./dist/bin/workerDev.js",
"debug": "NODE_ENV=development PUBSUB_EMULATOR_HOST=localhost:8005 FIRESTORE_EMULATOR_HOST=localhost:8006 nodemon --legacy-watch --watch ./dist --inspect=0.0.0.0:5858 --nolazy ./dist/bin/workerDev.js"
},
"repository": {
"type": "git",
@ -62,6 +63,7 @@
"factory-bot-ts": "^0.1.5",
"mocha": "^6.1.4",
"nock": "^10.0.6",
"nodemon": "^1.19.3",
"npm-run-all": "^4.1.5",
"p-event": "^4.1.0",
"prettier": "^1.17.1",

34
packages/fxa-geodb/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,34 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/test"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Mocha Current File",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/${relativeFile}"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
],
"compounds": []
}

29
packages/fxa-geodb/.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,29 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run Current Test",
"type": "shell",
"command": "./node_modules/mocha/bin/_mocha",
"args": [
"--recursive",
"--timeout",
"5000",
"--exit",
"${relativeFile}"
],
"group": "test",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
}
},
{
"label": "DB Patcher",
"type": "shell",
"command": "node ./bin/db_patcher.js >/dev/null",
}
],
}

41
packages/fxa-shared/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,41 @@
{
// 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": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"-r",
"ts-node/register",
"--recursive",
"${workspaceFolder}/test"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Mocha Current File",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"-r",
"ts-node/register",
"${workspaceFolder}/${relativeFile}"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}

30
packages/fxa-shared/.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,30 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "tsc-watch",
"command": "npm",
"args": ["run", "watch"],
"type": "shell",
"isBackground": true,
"group": "build",
"problemMatcher": "$tsc-watch",
"presentation": {
"reveal": "always"
}
},
{
"label": "Run Current Test",
"type": "shell",
"command": "./node_modules/mocha/bin/mocha",
"args": ["-r", "ts-node/register", "${relativeFile}"],
"group": "test",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
}
}
]
}

55
packages/fxa-support-panel/.vscode/launch.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,55 @@
{
// 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": "Local Nodemon",
"preLaunchTask": "tsc-watch",
"protocol": "auto",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "debug"],
"restart": true,
"port": 5858,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
},
{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"-r",
"ts-node/register",
"${workspaceFolder}/test/**/*.spec.ts",
"${workspaceFolder}/test/**/**/*.spec.ts"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Mocha Current File",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout",
"999999",
"--colors",
"-r",
"ts-node/register",
"${workspaceFolder}/${relativeFile}"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}

41
packages/fxa-support-panel/.vscode/tasks.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "tsc-watch",
"command": "npm",
"args": ["run", "watch"],
"type": "shell",
"isBackground": true,
"group": "build",
"problemMatcher": "$tsc-watch",
"presentation": {
"reveal": "always"
},
"dependsOn": "Stop Support Panel Server"
},
{
"label": "Run Current Test",
"type": "shell",
"command": "./node_modules/mocha/bin/mocha",
"args": ["-r", "ts-node/register", "${relativeFile}"],
"group": "test",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
}
},
{
"label": "Stop Support Panel Server",
"type": "shell",
"command": "pm2 stop 'support admin panel PORT 7100'"
},
{
"label": "Start Support Panel Server",
"type": "shell",
"command": "pm2 start 'support admin panel PORT 7100'"
}
]
}

2385
packages/fxa-support-panel/package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -12,8 +12,10 @@
"lint:deps": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
"test": "./node_modules/mocha/bin/mocha -r ts-node/register test/**/*.spec.ts test/**/**/*.spec.ts",
"shrink": "npmshrink && npm run postinstall",
"watch": "tsc -w",
"start-dev": "npm run build && node dist/bin/worker.js",
"start": "NODE_ENV=production node dist/bin/worker.js 2>&1"
"start": "NODE_ENV=production node dist/bin/worker.js 2>&1",
"debug": "NODE_ENV=development nodemon --legacy-watch --watch ./dist --inspect=0.0.0.0:5858 --nolazy dist/bin/worker.js"
},
"private": true,
"repository": {
@ -55,6 +57,7 @@
"fxa-conventional-changelog": "1.1.0",
"mocha": "^6.1.4",
"nock": "^10.0.6",
"nodemon": "^1.19.3",
"npm-run-all": "^4.1.5",
"npmshrink": "2.0.0",
"prettier": "^1.18.2",