Skip to content

Commit

Permalink
ci: one more fix for chunk test
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis committed Sep 20, 2024
1 parent e34dcf2 commit 53d6586
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/packem/__tests__/intigration/typescript.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1032,17 +1032,19 @@ export { AppContext };
const cjsContent = readFileSync(`${temporaryDirectoryPath}/dist/index.cjs`);
const cjsMatches: string[] = getRegexMatches(/require\('.*'\);/g, cjsContent);

const hasAnotherSharedApi = cjsContent.includes("anotherSharedApi");

expect(cjsMatches).toHaveLength(2);
expect(cjsContent).toBe(`'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const anotherSharedApi = ${cjsMatches[0] as string}
const ${hasAnotherSharedApi ? "anotherSharedApi" : "sharedApi"} = ${cjsMatches[0] as string}
const AppContext = ${cjsMatches[1] as string}
const index = "index";
exports.sharedApi = anotherSharedApi.sharedApi;
exports.sharedApi = ${hasAnotherSharedApi ? "anotherSharedApi" : "sharedApi"}.sharedApi;
exports.AppContext = AppContext.AppContext;
exports.index = index;
`);
Expand Down

0 comments on commit 53d6586

Please sign in to comment.