mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
Replace ts-jest with Sucrase Jest plugin
This commit is contained in:
parent
a164be0aee
commit
5fb7c3a45d
@ -5,5 +5,5 @@
|
||||
Upgrade build tools to their latest versions. This doesn't introduce breaking changes to the artifacts built using `@jspsych/config`, but it requires some minor changes to projects using `@jspsych/config`:
|
||||
|
||||
- The minimum required Node.js version is now 16.10.0
|
||||
- Jest has been upgraded from v28 to v29. If you are facing any issues due to this, please check Jest's [upgrade guide](https://jestjs.io/docs/upgrading-to-jest29) for instructions on updating your tests.
|
||||
- Jest has been upgraded from v28 to v29 and ts-jest has been replaced with the more performant Sucrase Jest plugin to avoid significant memory leaks. As a consequence, Jest does no longer type-check code. If you are facing any issues, please check Jest's [upgrade guide](https://jestjs.io/docs/upgrading-to-jest29) for instructions on updating your tests.
|
||||
- TypeScript has been upgraded from version 4 to version 5. This is very unlikely to break anything in your code though.
|
||||
|
2935
package-lock.json
generated
2935
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -27,14 +27,14 @@
|
||||
"devDependencies": {
|
||||
"@changesets/changelog-github": "^0.4.4",
|
||||
"@changesets/cli": "^2.22.0",
|
||||
"alias-hq": "github:bjoluc/alias-hq#tsconfig-parsing-quickfix",
|
||||
"husky": "^8.0.1",
|
||||
"import-sort-style-module": "^6.0.0",
|
||||
"jest": "*",
|
||||
"lint-staged": "^12.4.1",
|
||||
"prettier": "^2.6.2",
|
||||
"prettier-plugin-import-sort": "^0.0.7",
|
||||
"turbo": "^1.2.9",
|
||||
"jest": "*",
|
||||
"ts-jest": "*"
|
||||
"turbo": "^1.2.9"
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 100
|
||||
|
@ -1,21 +1,13 @@
|
||||
const ts = require("typescript");
|
||||
const { pathsToModuleNameMapper } = require("ts-jest");
|
||||
const hq = require("alias-hq");
|
||||
|
||||
/** @type { (dirname: string) => import('@jest/types').Config.InitialOptions } */
|
||||
module.exports.makePackageConfig = (dirname) => {
|
||||
const packageJson = require(dirname + "/package.json");
|
||||
const packageBaseName = packageJson.name.replace("@jspsych/", "");
|
||||
|
||||
// based on https://github.com/formium/tsdx/blob/462af2d002987f985695b98400e0344b8f2754b7/src/createRollupConfig.ts#L51-L57
|
||||
const tsCompilerOptions = ts.parseJsonConfigFileContent(
|
||||
ts.readConfigFile(dirname + "/tsconfig.json", ts.sys.readFile).config,
|
||||
ts.sys,
|
||||
dirname
|
||||
).options;
|
||||
|
||||
return {
|
||||
preset: "ts-jest",
|
||||
moduleNameMapper: pathsToModuleNameMapper(tsCompilerOptions.paths, { prefix: "<rootDir>/" }),
|
||||
transform: { "\\.(js|jsx|ts|tsx)$": "@sucrase/jest-plugin" },
|
||||
moduleNameMapper: hq.load(dirname + "/tsconfig.json").get("jest"),
|
||||
testEnvironment: "jsdom",
|
||||
testEnvironmentOptions: {
|
||||
fetchExternalResources: true,
|
||||
|
@ -48,8 +48,10 @@
|
||||
"@rollup/plugin-node-resolve": "15.2.1",
|
||||
"@rollup/plugin-replace": "5.0.2",
|
||||
"@rollup/plugin-terser": "0.4.3",
|
||||
"@sucrase/jest-plugin": "3.0.0",
|
||||
"@types/gulp": "4.0.13",
|
||||
"@types/jest": "29.5.4",
|
||||
"alias-hq": "github:bjoluc/alias-hq#tsconfig-parsing-quickfix",
|
||||
"babel-preset-minify": "0.5.2",
|
||||
"canvas": "2.11.2",
|
||||
"gulp": "4.0.2",
|
||||
@ -64,7 +66,7 @@
|
||||
"regenerator-runtime": "0.14.0",
|
||||
"rollup": "3.28.1",
|
||||
"rollup-plugin-typescript2": "0.35.0",
|
||||
"ts-jest": "29.1.1",
|
||||
"sucrase": "3.34.0",
|
||||
"tslib": "2.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user