test-js-with-node: Fix source maps for coverage.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-02-24 11:46:13 -08:00 committed by Anders Kaseorg
parent 42775219b3
commit a2ea5e8598
4 changed files with 28 additions and 27 deletions

View File

@ -24,6 +24,7 @@
"autosize": "^5.0.1",
"babel-loader": "^9.1.0",
"babel-plugin-formatjs": "^10.2.6",
"babel-plugin-istanbul": "^6.1.1",
"blueimp-md5": "^2.10.0",
"clean-css": "^5.1.0",
"clipboard": "^2.0.4",

View File

@ -48,4 +48,4 @@ API_FEATURE_LEVEL = 164
# historical commits sharing the same major version, in which case a
# minor version bump suffices.
PROVISION_VERSION = (223, 0)
PROVISION_VERSION = (223, 1)

View File

@ -31,6 +31,7 @@ require("@babel/register")({
new RegExp("^" + _.escapeRegExp(path.resolve(__dirname, "../../src") + path.sep)),
],
plugins: [
...(process.env.USING_INSTRUMENTED_CODE ? [["istanbul", {exclude: []}]] : []),
"babel-plugin-rewire-ts",
["@babel/plugin-transform-modules-commonjs", {lazy: () => true}],
],
@ -76,19 +77,6 @@ handlebars.hook_require();
const noop = function () {};
/* istanbul ignore next */
function short_tb(tb) {
const lines = tb.split("\n");
const i = lines.findIndex((line) => line.includes("run_one_module"));
if (i === -1) {
return tb;
}
return lines.splice(0, i + 1).join("\n") + "\n(...)\n";
}
require("../../src/templates"); // register Zulip extensions
async function run_one_module(file) {
@ -140,16 +128,6 @@ test.set_verbose(files.length === 1);
namespace.finish();
}
})().catch((error) => /* istanbul ignore next */ {
if (process.env.USING_INSTRUMENTED_CODE) {
console.info(`
TEST FAILED! Before using the --coverage option please make sure that your
tests work under normal conditions.
`);
} else if (error.stack) {
console.info(short_tb(error.stack));
} else {
console.info(error);
}
console.error(error);
process.exit(1);
});

View File

@ -64,7 +64,7 @@
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.14.tgz#4106fc8b755f3e3ee0a0a7c27dde5de1d2b2baf8"
integrity sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw==
"@babel/core@^7.10.4", "@babel/core@^7.5.5", "@babel/core@^7.7.5":
"@babel/core@^7.10.4", "@babel/core@^7.12.3", "@babel/core@^7.5.5", "@babel/core@^7.7.5":
version "7.20.12"
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.12.tgz#7930db57443c6714ad216953d1356dac0eb8496d"
integrity sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg==
@ -316,7 +316,7 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
"@babel/parser@^7.1.0", "@babel/parser@^7.20.13", "@babel/parser@^7.20.7":
"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.13", "@babel/parser@^7.20.7":
version "7.20.15"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.15.tgz#eec9f36d8eaf0948bb88c87a46784b5ee9fd0c89"
integrity sha512-DI4a1oZuf8wC+oAJA9RW6ga3Zbe8RZFt7kD9i4qAspz3I/yHet1VvC3DiSy/fsUvv5pvJuNPh0LPOdCcqinDPg==
@ -2735,6 +2735,17 @@ babel-plugin-formatjs@^10.2.6:
"@types/babel__traverse" "^7.1.7"
tslib "^2.4.0"
babel-plugin-istanbul@^6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73"
integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
"@istanbuljs/load-nyc-config" "^1.0.0"
"@istanbuljs/schema" "^0.1.2"
istanbul-lib-instrument "^5.0.4"
test-exclude "^6.0.0"
babel-plugin-macros@^2.0.0:
version "2.8.0"
resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz#0f958a7cc6556b1e65344465d99111a1e5e10138"
@ -6596,6 +6607,17 @@ istanbul-lib-instrument@^4.0.0:
istanbul-lib-coverage "^3.0.0"
semver "^6.3.0"
istanbul-lib-instrument@^5.0.4:
version "5.2.1"
resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d"
integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==
dependencies:
"@babel/core" "^7.12.3"
"@babel/parser" "^7.14.7"
"@istanbuljs/schema" "^0.1.2"
istanbul-lib-coverage "^3.2.0"
semver "^6.3.0"
istanbul-lib-processinfo@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz#366d454cd0dcb7eb6e0e419378e60072c8626169"