-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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(tests): migrate to vitest #1753
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
18b1a9f
test: migrate to vitest
arjunvegda 0aea49b
chore: merge origin/main
arjunvegda 49bc440
test: try #1 remove CI-MATRIX tags
arjunvegda 96f4a69
test: try 2 remove import/require replace
arjunvegda 90f623d
Merge branch 'main' into test/migrate-to-vitest
arjunvegda 3befb2b
chore: remove unused scripts/assignments
arjunvegda f5560ad
chore(test-multiple-builds.yml): remove import/require replace script
arjunvegda b0c4a70
Merge branch 'main' into test/migrate-to-vitest
dai-shi 1b2e647
fix merging main
dai-shi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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 |
---|---|---|
|
@@ -91,12 +91,10 @@ | |
"eslint": "eslint --no-eslintrc --c .eslintrc.json --fix '*.{js,json}' '{src,tests}/**/*.{ts,tsx}'", | ||
"eslint:ci": "eslint --no-eslintrc --c .eslintrc.json '*.{js,json}' '{src,tests}/**/*.{ts,tsx}'", | ||
"pretest": "tsc --noEmit", | ||
"test": "yarn node --experimental-vm-modules $(yarn bin jest)", | ||
"test:ci": "yarn node --experimental-vm-modules $(yarn bin jest)", | ||
"test:dev": "yarn node --experimental-vm-modules $(yarn bin jest) --watch --no-coverage", | ||
"test:coverage:watch": "yarn node --experimental-vm-modules $(yarn bin jest) --watch", | ||
"test": "vitest --ui --coverage", | ||
"test:ci": "vitest", | ||
"patch-d-ts": "node -e \"var {entries}=require('./rollup.config.js');require('shelljs').find('dist/**/*.d.ts').forEach(f=>{entries.forEach(({find,replacement})=>require('shelljs').sed('-i',new RegExp(' from \\''+find.source.slice(0,-1)+'\\';$'),' from \\''+replacement+'\\';',f));require('shelljs').sed('-i',/ from '(\\.[^']+)\\.ts';$/,' from \\'\\$1\\';',f)})\"", | ||
"copy": "shx cp -r dist/src/* dist/esm && shx cp -r dist/src/* dist && shx rm -rf dist/src && shx rm -rf dist/{src,tests} && downlevel-dts dist dist/ts3.4 && shx cp package.json readme.md LICENSE dist && json -I -f dist/package.json -e \"this.private=false; this.devDependencies=undefined; this.optionalDependencies=undefined; this.scripts=undefined; this.prettier=undefined; this.jest=undefined;\"", | ||
"copy": "shx cp -r dist/src/* dist/esm && shx cp -r dist/src/* dist && shx rm -rf dist/src && shx rm -rf dist/{src,tests} && downlevel-dts dist dist/ts3.4 && shx cp package.json readme.md LICENSE dist && json -I -f dist/package.json -e \"this.private=false; this.devDependencies=undefined; this.optionalDependencies=undefined; this.scripts=undefined; this.prettier=undefined;\"", | ||
"patch-esm-ts": "node -e \"require('shelljs').find('dist/esm/**/*.d.ts').forEach(f=>{var f2=f.replace(/\\.ts$/,'.mts');require('fs').copyFileSync(f,f2);require('shelljs').sed('-i',/ from '(\\.[^']+)';$/,' from \\'\\$1.mjs\\';',f2);require('shelljs').sed('-i',/^declare module '(\\.[^']+)'/,'declare module \\'\\$1.mjs\\'',f2)})\"" | ||
}, | ||
"engines": { | ||
|
@@ -132,44 +130,9 @@ | |
"url": "https://github.com/pmndrs/zustand/issues" | ||
}, | ||
"homepage": "https://github.com/pmndrs/zustand", | ||
"jest": { | ||
"rootDir": ".", | ||
"testEnvironment": "jsdom", | ||
"preset": "ts-jest/presets/default-esm", | ||
"transform": { | ||
"^.+\\.(t|j)sx?$": [ | ||
"ts-jest", | ||
{ | ||
"useESM": true | ||
} | ||
] | ||
}, | ||
"extensionsToTreatAsEsm": [ | ||
".ts", | ||
".tsx" | ||
], | ||
"moduleNameMapper": { | ||
"^zustand$": "<rootDir>/src/index.ts", | ||
"^zustand/(.*)$": "<rootDir>/src/$1.ts" | ||
}, | ||
"modulePathIgnorePatterns": [ | ||
"dist" | ||
], | ||
"testRegex": "test.(js|ts|tsx)$", | ||
"coverageDirectory": "./coverage/", | ||
"collectCoverage": true, | ||
"coverageReporters": [ | ||
"json", | ||
"html", | ||
"text", | ||
"text-summary" | ||
], | ||
"collectCoverageFrom": [ | ||
"src/**/*.{js,ts,tsx}", | ||
"tests/**/*.{js,ts,tsx}" | ||
] | ||
}, | ||
"dependencies": { | ||
"@vitest/ui": "^0.30.1", | ||
"eslint-plugin-vitest": "^0.1.4", | ||
Comment on lines
+134
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't notice when reviewing, but these shouldn't be in dependencies. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"use-sync-external-store": "1.2.0" | ||
}, | ||
"devDependencies": { | ||
|
@@ -192,20 +155,19 @@ | |
"@types/use-sync-external-store": "^0.0.3", | ||
"@typescript-eslint/eslint-plugin": "^5.57.0", | ||
"@typescript-eslint/parser": "^5.57.0", | ||
"@vitest/coverage-c8": "^0.30.1", | ||
"concurrently": "^8.0.1", | ||
"downlevel-dts": "^0.11.0", | ||
"esbuild": "^0.17.14", | ||
"eslint": "^8.37.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-import-resolver-alias": "^1.1.2", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-jest": "^27.2.1", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-react": "^7.32.2", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"immer": "^9.0.21", | ||
"jest": "^29.5.0", | ||
"jest-environment-jsdom": "^29.5.0", | ||
"jsdom": "^21.1.1", | ||
"json": "^11.0.0", | ||
"prettier": "^2.8.7", | ||
"react": "^18.2.0", | ||
|
@@ -214,8 +176,8 @@ | |
"rollup": "^3.20.2", | ||
"rollup-plugin-esbuild": "^5.0.0", | ||
"shx": "^0.3.4", | ||
"ts-jest": "^29.0.5", | ||
"typescript": "^5.0.3" | ||
"typescript": "^5.0.3", | ||
"vitest": "^0.30.1" | ||
}, | ||
"peerDependencies": { | ||
"immer": ">=9.0", | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should remove L80 too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize that one.
I meant this:
sed -i~ 's/= await import(/= require(/' tests/devtools.test.tsx
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! I'm surprised that it did not cause the tests to fail this time 🤔 Fixed it in this commit