Skip to content

Commit

Permalink
test: use sourcemaps in unit tests (#6485)
Browse files Browse the repository at this point in the history
Introduce the source-map-support package and require it for mocha running unit tests.

Turn on the sourceMap option for tsconfig.base.json so that the sourceMappingURL= line is emitted in the generated files.

Co-authored-by: Mathias Bynens <mathias@qiwi.be>
  • Loading branch information
psmarshall and mathiasbynens committed Nov 26, 2020
1 parent fb85911 commit 46e74ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion mocha-config/puppeteer-unit-tests.js
Expand Up @@ -18,7 +18,11 @@ const base = require('./base');

module.exports = {
...base,
require: ['./test/mocha-ts-require', './test/mocha-utils.ts'],
require: [
'./test/mocha-ts-require',
'./test/mocha-utils.ts',
'source-map-support/register',
],
spec: 'test/*.spec.ts',
extension: ['js', 'ts'],
retries: process.env.CI ? 2 : 0,
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -96,6 +96,7 @@
"pngjs": "^5.0.0",
"prettier": "^2.1.2",
"sinon": "^9.0.2",
"source-map-support": "^0.5.19",
"standard-version": "^9.0.0",
"text-diff": "^1.0.1",
"ts-node": "^9.0.0",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.base.json
Expand Up @@ -8,6 +8,7 @@
"module": "ESNext",
"declaration": true,
"declarationMap": true,
"resolveJsonModule": true
"resolveJsonModule": true,
"sourceMap": true,
}
}

0 comments on commit 46e74ff

Please sign in to comment.