-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b5e0df
commit 5a802d4
Showing
4 changed files
with
15 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,22 @@ | ||
import type { Config } from '@jest/types'; | ||
import { createDefaultEsmPreset } from 'ts-jest'; | ||
|
||
const config: Config.InitialOptions = { | ||
...createDefaultEsmPreset(), | ||
globalSetup: './test/setup.js', | ||
clearMocks: true, | ||
coverageProvider: 'v8', | ||
testEnvironment: 'node', | ||
verbose: true, | ||
|
||
preset: 'ts-jest/presets/js-with-babel', | ||
transformIgnorePatterns: ['node_modules/(?!@polkadot)/'], | ||
extensionsToTreatAsEsm: ['.ts'], | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.js$': '$1', | ||
|
||
// manually resolving hooks to esm, cuz somehow jest resolves it to cjs? | ||
// if main property in a package.json is pointing to esm, there's no problem whatsoever. | ||
// maybe it has something to do with the package folder structure | ||
'^@gear-js/react-hooks$': '<rootDir>/../node_modules/@gear-js/react-hooks/dist/esm/index.mjs', | ||
}, | ||
|
||
testTimeout: 15_000, | ||
|
||
// cuz hooks testEnvironment is jsdom. there was a problem with rxjs for example | ||
// https://github.com/microsoft/accessibility-insights-web/pull/5421#issuecomment-1109168149 | ||
// https://jest-archive-august-2023.netlify.app/docs/28.x/upgrading-to-jest28/#packagejson-exports | ||
testEnvironmentOptions: { | ||
customExportConditions: ['node'], | ||
transform: { | ||
'^.+\\.tsx?$': ['ts-jest', { useESM: true }], | ||
}, | ||
testTimeout: 15_000, | ||
testPathIgnorePatterns: ['demo-hooks.test.tsx'], // ignore hooks test | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters