From 46e74ff3f549ef9a99a40114a4b6305a0f88ffab Mon Sep 17 00:00:00 2001 From: Peter Marshall Date: Thu, 26 Nov 2020 14:51:17 +0100 Subject: [PATCH] test: use sourcemaps in unit tests (#6485) 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 --- mocha-config/puppeteer-unit-tests.js | 6 +++++- package.json | 1 + tsconfig.base.json | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mocha-config/puppeteer-unit-tests.js b/mocha-config/puppeteer-unit-tests.js index cb1bb7cae9c..be39c5b9ae6 100644 --- a/mocha-config/puppeteer-unit-tests.js +++ b/mocha-config/puppeteer-unit-tests.js @@ -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, diff --git a/package.json b/package.json index 18ff4d40269..3c5bc1c0f58 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tsconfig.base.json b/tsconfig.base.json index 97d1cd068a4..8e2d98cf2a1 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -8,6 +8,7 @@ "module": "ESNext", "declaration": true, "declarationMap": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "sourceMap": true, } }