summaryrefslogtreecommitdiff
path: root/packages/backend/jest.config.cjs
diff options
context:
space:
mode:
authorKagami Sascha Rosylight <saschanaz@outlook.com>2023-02-12 09:18:31 +0100
committerGitHub <noreply@github.com>2023-02-12 17:18:31 +0900
commit9965bc8f9457692eb8b18efa7d9f68e5bae97d24 (patch)
tree3b5fd0f228d3d4466f62cdd447d528175360b1f1 /packages/backend/jest.config.cjs
parentenhance(client): リアクションが無いことを伝える (#9901) (diff)
downloadmisskey-9965bc8f9457692eb8b18efa7d9f68e5bae97d24.tar.gz
misskey-9965bc8f9457692eb8b18efa7d9f68e5bae97d24.tar.bz2
misskey-9965bc8f9457692eb8b18efa7d9f68e5bae97d24.zip
Fix moduleNameMapper to not resolve `.wasm.js` to `.wasm` (#9894)
* Fix moduleNameMapper to not resolve `.wasm.js` to `.js` Fixes #9767 Undici [tries to import `./llhttp/llhttp.wasm.js`](https://github.com/nodejs/undici/blob/e155c6db5cec9bc577d548fa7c7378013631c79c/lib/client.js#L342) which is currently broken by the (hacky) module name mapper. * longer timeout value * 30s * 50s * 60s to be safe * Revert "60s to be safe" This reverts commit f3e0f5796273c0cdcbd901e8c08ae3136b9768f8. * 2cc98226cac2e0a08332e1ce281ba8917c5b58fc revert? * revert * remove timeout * detectOpenHandles * Really solved? * Revert "detectOpenHandles" This reverts commit 29214bdff80e15998f34171bf409d454a3d10129. * Add `coveragePathIgnorePatterns` * Revert "Add `coveragePathIgnorePatterns`" This reverts commit fcf8c6806b339b7c21f53137f9939d00020904aa. * Import jsonld dynamically * remove import * add comment --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/backend/jest.config.cjs')
-rw-r--r--packages/backend/jest.config.cjs11
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/backend/jest.config.cjs b/packages/backend/jest.config.cjs
index f0a3dc16c2..2f11f6a3e9 100644
--- a/packages/backend/jest.config.cjs
+++ b/packages/backend/jest.config.cjs
@@ -83,7 +83,14 @@ module.exports = {
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
moduleNameMapper: {
- "^@/(.*?).js": "<rootDir>/src/$1.ts",
+ // Do not resolve .wasm.js to .wasm by the rule below
+ '^(.+)\\.wasm\\.js$': '$1.wasm.js',
+ // SWC converts @/foo/bar.js to `../../src/foo/bar.js`, and then this rule
+ // converts it again to `../../src/foo/bar` which then can be resolved to
+ // `.ts` files.
+ // See https://github.com/swc-project/jest/issues/64#issuecomment-1029753225
+ // TODO: Use `--allowImportingTsExtensions` on TypeScript 5.0 so that we can
+ // directly import `.ts` files without this hack.
'^(\\.{1,2}/.*)\\.js$': '$1',
},
@@ -112,7 +119,7 @@ module.exports = {
// resetModules: false,
// A path to a custom resolver
- resolver: './jest-resolver.cjs',
+ // resolver: './jest-resolver.cjs',
// Automatically restore mock state between every test
restoreMocks: true,