Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to jest@28 #937

Merged
merged 4 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const tsModuleNameMapper = pathsToModuleNameMapper(tsconfig.compilerOptions.path
const baseConfig = {
preset: 'ts-jest',
testRunner: 'jest-jasmine2',
resolver: '<rootDir>/tools/dev-tool/src/jest-resolver.js',
coverageProvider: process.env.JEST_COVERAGE_PROVIDER || 'babel',
// https://dev.to/vantanev/make-your-jest-tests-up-to-20-faster-by-changing-a-single-setting-i36
maxWorkers: '50%',
Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"@types/temp": "^0.9.1",
"@types/write-pkg": "^4.0.0",
"@types/ws": "^6.0.1",
"@types/yargs": "^16",
"@typescript-eslint/eslint-plugin": "^5.12.1",
"@typescript-eslint/parser": "^5.12.1",
"async-retry": "^1.3.1",
Expand All @@ -126,26 +127,24 @@
"got": "^11.8.3",
"handlebars": "^4.7.3",
"is-git-clean": "^1.1.0",
"jest": "^27.5.1",
"jest-jasmine2": "^27.5.1",
"jest": "^28.0.3",
"jest-environment-jsdom": "^28.0.2",
"jest-jasmine2": "^28.0.3",
"jsdom": "^19.0.0",
"jsdom-worker": "^0.2.1",
"mkdirp": "^0.5.1",
"node-fetch": "^2.6.1",
"offline-iconfont": "^1.1.0",
"parse-github-url": "^1.0.2",
"prettier": "^2.5.1",
"read-pkg": "^5.2.0",
"regenerator-runtime": "^0.13.3",
"rimraf": "^3.0.2",
"runscript": "^1.4.0",
"semver": "^6.3.0",
"simple-git": "^3.3.0",
"strip-html-comments": "^1.0.0",
"temp": "^0.9.4",
"ts-jest": "^27.0.3",
"uuid": "^8.3.2",
"ts-jest": "^28.0.0",
"write-pkg": "^4.0.0",
"yargs": "^16.1.0",
"yauzl": "^2.10.0"
}
}
1 change: 0 additions & 1 deletion packages/core-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"ajv": "^6.10.0",
"classnames": "2.2.6",
"clsx": "^1.0.4",
"file-icons-js": "^1.0.3",
"font-awesome": "^4.7.0",
"fuzzy": "^0.1.3",
"jsonc-parser": "^2.1.0",
Expand Down
1 change: 0 additions & 1 deletion packages/extension-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"fs-extra": "^8.1.0",
"node-fetch": "^2.6.1",
"requestretry": "^7.0.0",
"uuid": "^8.3.2",
"yauzl": "^2.10.0"
},
"devDependencies": {
Expand Down
4 changes: 1 addition & 3 deletions packages/file-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@
"mv": "^2.1.1",
"nsfw": "^2.1.2",
"trash": "^5.2.0",
"uuid": "^3.3.2",
"vscode-languageserver-types": "^3.16.0",
"write-file-atomic": "^3.0.0"
},
"devDependencies": {
"@opensumi/ide-core-browser": "2.17.2",
"@opensumi/ide-dev-tool": "^1.3.1",
"@types/mv": "^2.1.0",
"@types/uuid": "^3.4.4"
"@types/mv": "^2.1.0"
}
}
2 changes: 1 addition & 1 deletion scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { argv } from 'yargs';
import git from 'git-rev-sync';
import chalk from 'chalk';

import pkg from '../package.json';
import pkg from '../lerna.json';
import Package, { readAllMainPackages } from './pkg';
import { generateManifest } from './manifest';

Expand Down
4 changes: 2 additions & 2 deletions scripts/start.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { startFromFolder } from './fn/module';
import { argv } from 'yargs';
const folderName = argv.folder as string || 'packages/startup';
const scriptName = argv.script as string || 'start';
const folderName = (argv.folder as string) || 'packages/startup';
const scriptName = (argv.script as string) || 'start';

if (!folderName) {
throw Error('folderName is required.');
Expand Down
16 changes: 16 additions & 0 deletions tools/dev-tool/src/jest-resolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 关于 resolver 的文档请看: https://jestjs.io/docs/configuration#resolver-string

module.exports = (path, options) =>
// Call the defaultResolver, so we leverage its cache, error handling, etc.
options.defaultResolver(path, {
...options,
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
packageFilter: (pkg) => {
if (pkg.name === 'nanoid') {
// 一个对于 jest@28 的 workaround,具体原因请见:https://github.com/microsoft/accessibility-insights-web/pull/5421/commits/9ad4e618019298d82732d49d00aafb846fb6bac7
delete pkg['exports'];
delete pkg['module'];
}
return pkg;
},
});
4 changes: 0 additions & 4 deletions typings/css.escape/index.d.ts

This file was deleted.

4 changes: 0 additions & 4 deletions typings/file-icons-js/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion typings/path-match/index.d.ts

This file was deleted.

9 changes: 0 additions & 9 deletions typings/rc/index.d.ts

This file was deleted.