Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shrinktofit committed Sep 18, 2023
1 parent 165bbfd commit a4f83ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ module.exports = {
// ignore everything in the node_modules EXCEPT for:
// - @cocos/dragonbones-js
'node_modules/(?!(@cocos/dragonbones-js)/)',
'native/external/emscripten/',
// ignore everything in the native/external/emscripten EXCEPT for:
// - meshopt
// Since above packages are in ESM module format, whereas we currently use CJS for testing.
'native/external/emscripten/(?!(meshopt)/)',
],
setupFilesAfterEnv: [
"./tests/setup-after-env.ts",
Expand Down
9 changes: 1 addition & 8 deletions tests/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jest.mock(
'external:emscripten/physx/physx.release.wasm.wasm',
'external:emscripten/spine/spine.wasm',
'external:emscripten/box2d/box2d.release.wasm.wasm',
'external:emscripten/meshopt/meshopt_decoder.wasm.wasm',
].forEach(mockModuleId => {
jest.mock(mockModuleId,
() => ({
Expand All @@ -91,14 +92,6 @@ jest.mock(
);
});

jest.mock('external:emscripten/meshopt/meshopt_decoder.wasm.wasm',
() => ({
__esModule: true,
default: 'this should be a wasm url',
}),
{ virtual: true, },
);

jest.mock('../cocos/core/platform/debug', () => {
const result = {
__esModule: true, // Use it when dealing with esModules
Expand Down

0 comments on commit a4f83ad

Please sign in to comment.