Skip to content

Commit

Permalink
work around tree shaking issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Jun 5, 2024
1 parent 548d762 commit 3dcbdbb
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions crates/turbopack-tests/js/jest-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
const jest = __turbopack_external_require__("jest-circus");
const expectMod = __turbopack_external_require__("expect");

globalThis.describe = jest.describe;
globalThis.it = jest.it;
globalThis.test = jest.test;
globalThis.expect = expectMod.expect;

// From https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/test/TestCases.template.js#L422
globalThis.nsObj = function nsObj(obj) {
Object.defineProperty(obj, Symbol.toStringTag, {
value: "Module",
});
return obj;
};
function setupGlobals() {
globalThis.describe = jest.describe;
globalThis.it = jest.it;
globalThis.test = jest.test;
globalThis.expect = expectMod.expect;

// From https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/test/TestCases.template.js#L422
globalThis.nsObj = function nsObj(obj) {
Object.defineProperty(obj, Symbol.toStringTag, {
value: "Module",
});
return obj;
};
}

const uncaughtExceptions: string[] = [];
const unhandledRejections: string[] = [];
Expand All @@ -28,6 +30,8 @@ process.on("unhandledRejection", (e) => {
});

export default async function run() {
setupGlobals();

await import("TESTS");

const jestResult = await jest.run();
Expand Down

0 comments on commit 3dcbdbb

Please sign in to comment.