Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2035,6 +2035,7 @@
"@types/semver": "^7.7.1",
"@types/sinon": "^17.0.4",
"@types/sinon-chai": "^3.2.12",
"@types/source-map-support": "^0.5.10",
"@types/svg2ttf": "^5.0.3",
"@types/svgicons2svgfont": "^10.0.5",
"@types/ttf2woff": "^2.0.4",
Expand Down
21 changes: 18 additions & 3 deletions test/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,34 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
// Use source-map-support to get better stack traces
import "source-map-support/register";

import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as chaiSubset from "chai-subset";
import * as fs from "fs";
import * as mockFS from "mock-fs";
import * as path from "path";
import * as sinonChai from "sinon-chai";
import * as sourceMapSupport from "source-map-support";
import * as tsConfigPaths from "tsconfig-paths";

import { installTagSupport } from "./tags";

// Use source-map-support to get better stack traces.
//
// We have to override retrieveFile() here because any test that uses mock-fs will break
// source map lookups. This will make sure that, even if mock-fs is in effect, source map
// support can still find the files that it needs to.
sourceMapSupport.install({
retrieveFile(path: string): string | null {
return mockFS.bypass(() => {
if (!fs.existsSync(path)) {
return null;
}
return fs.readFileSync(path, "utf-8");
});
},
});

const tsConfig = JSON.parse(
// __dirname points to dist/test when transpiled, but we need the tsconfig.json in the real test/
fs.readFileSync(path.join(__dirname, "../../test/tsconfig.json"), "utf-8")
Expand Down