dev: Add package.json tasks to aid debugging supervisor tests

Running mocha on the coffee and ts sources resulted in unreliable
sourcemaps, and breakpoints not working, among other things. To solve
this, this commit adds package.json tasks which will build both the
coffeescript and typescript files with their sourcemaps and places it
into a build directory. It also copies over other dependent files, such
as test data and migrations.

Another task adds a mocha debugging command, which can be connected to
using a node debugger.

Another tasks runs mocha without a debugging interface, but also without
running linters etc first. This enables the tests to be run much faster.

Change-type: minor
Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
Cameron Diver 2018-08-15 16:07:12 +01:00
parent a4959f2ac3
commit 1060e70e82
No known key found for this signature in database
GPG Key ID: 69264F9C923F55C1
2 changed files with 4 additions and 1 deletions

View File

@ -12,6 +12,9 @@
"build": "webpack", "build": "webpack",
"lint": "resin-lint --typescript src/ test/", "lint": "resin-lint --typescript src/ test/",
"test": "npm run lint && JUNIT_REPORT_PATH=report.xml mocha --exit -r ts-node/register -r coffee-script/register -r register-coffee-coverage test/*.{js,coffee} && npm run coverage", "test": "npm run lint && JUNIT_REPORT_PATH=report.xml mocha --exit -r ts-node/register -r coffee-script/register -r register-coffee-coverage test/*.{js,coffee} && npm run coverage",
"test:fast": "mocha --exit -r ts-node/register -r coffee-script/register test/*.{js,coffee}",
"test:build": "tsc && coffee -m -c -o build . && cp -r test/data build/test/ && cp -r src/migrations build/src && cp package.json build",
"test:debug": "npm run test:build && mocha --inspect-brk build/test/*.js",
"versionist": "versionist", "versionist": "versionist",
"coverage": "istanbul report text && istanbul report html" "coverage": "istanbul report text && istanbul report html"
}, },

View File

@ -8,7 +8,7 @@
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"strictNullChecks": true, "strictNullChecks": true,
"outDir": "./build" "outDir": "./build/src/"
}, },
"include": [ "include": [
"src/**/*.ts", "src/**/*.ts",