-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[code-infra] Replace mocha
with vitest
for browser & jsdom tests
#14508
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
Merged
Merged
Changes from 250 commits
Commits
Show all changes
625 commits
Select commit
Hold shift + click to select a range
6f9e916
skip tests
JCQuintas d1ac98d
skip test
JCQuintas 642e4ef
skip all in browser
JCQuintas ca4eaba
ignore all in browser
JCQuintas 0f8c8cf
remove parallelism
JCQuintas e9853e0
fix date pickers isolation issues
JCQuintas 11fa02b
fix datagrid isolate
JCQuintas a352883
fix datepickers pro isolate
JCQuintas 1f80763
datagrid test isolate
JCQuintas fe0b0d6
fix charts isolate
JCQuintas edd2907
turn on isolate ci
JCQuintas abcb953
Merge commit '3697464969746f746e17342bf97cff79657dfd71' into vitest-x…
JCQuintas da00ea5
update packages
JCQuintas 001e933
fix ci
JCQuintas dda8ecd
fix test
JCQuintas e17895d
add telemetry tests
JCQuintas f87f521
try fixes
JCQuintas 66dc80b
try closing dialog after test
JCQuintas 36664df
Merge branch 'master' into vitest-x-browser-working
JCQuintas 7b7c193
remove changes
JCQuintas 45c6a1a
fix matchmedia
JCQuintas 533665b
m+
JCQuintas 701bd9c
increase timeout for tests
JCQuintas d34359c
increase worker
JCQuintas aaa574f
decrease workers
JCQuintas 9038bed
revert
JCQuintas f6257e4
decrease timeout
JCQuintas 6d30ab1
add act on focus
JCQuintas 522819b
use vmthreads
JCQuintas 2f04cd7
env stubbing and threads
JCQuintas bd37ddf
fix type
JCQuintas 3d25a4b
large
JCQuintas 3b7044a
back to forks
JCQuintas 106cf06
try preventing issue in charts
JCQuintas 5c1c485
Merge commit 'ca5f2a04ebba7b4a3a31358f8e656a8d833d41c6' into vitest-x…
JCQuintas 7ba5dbd
run on medium with single thread
JCQuintas 12a557f
add fail on console
JCQuintas 44b7a0a
decrease to medium
JCQuintas bf5ff4b
mw2
JCQuintas 3df9fb5
big test timetout
JCQuintas c47e28e
disable parallelism
JCQuintas c0ee4a5
move to ci
JCQuintas 445a754
comment
JCQuintas 4ffa9f1
Merge commit '519dad717f84c43d38b66d6c8fe67f2800246e2c' into vitest-x…
JCQuintas 74d97ef
remove global vi
JCQuintas c6484db
remove matrix
JCQuintas 332a58e
speedup by removing checkout requirement
JCQuintas c2a78ff
upgrade vitest
JCQuintas d24941b
enable coverage
JCQuintas f7af0bb
make retry global
JCQuintas bd28140
remove fake clock
JCQuintas b62b902
remove "createFakeClock"
JCQuintas 1de5e03
Merge commit '7eb128d9c968ea9bf3a029f8b041d41d53f168c6' into vitest-x…
JCQuintas 42de77d
fix fake clock tests
JCQuintas 0d66e4e
render
JCQuintas 67a8d5a
fix wrong date
JCQuintas db7ede4
fix missing fake clock
JCQuintas a3145c1
fix waitfor
JCQuintas 2a7508a
Merge commit 'd8d707171cda79e168c89df3474587b9322a2695' into vitest-x…
JCQuintas 657a5ea
act and vi timers
JCQuintas 71729a9
fix datapickers
JCQuintas 2acfb89
Merge commit 'e895436e50fa006e1ebe7e79cf99d9f48e7d0bb2' into vitest-x…
JCQuintas 775a4cd
Merge commit '03c32eba5313d0c71acf438941411c7641f9b72f' into vitest-x…
JCQuintas 288eb22
fix merge issues
JCQuintas 00da37e
Merge commit '7c80083adc800324accee8288cb6c4a58c033f55' into vitest-x…
JCQuintas a28374e
revert unnecessary changes
JCQuintas eed8451
Merge commit '53bf0013401abf2e0fe11a48a1080783a42b94b0' into vitest-x…
JCQuintas cc32291
dedupe
JCQuintas b255641
upgrade vitest
JCQuintas 34feadf
remove unnecessary async
JCQuintas d1e04a2
fix grid new column menu names
JCQuintas fab8abb
fix issues
JCQuintas 3f9e03b
Merge branch 'master' into vitest-x-browser-working
JCQuintas 6d10490
Merge branch 'master' into vitest-x-browser-working
JCQuintas 950d9f0
Merge commit '06d8025ed7b5eb14b4d125924b4eeefea9af12a2' into vitest-x…
JCQuintas b27c461
remove clock usage
JCQuintas 2e1a05a
Revert "remove unnecessary async"
JCQuintas c5fccba
try awaiting datagrid
JCQuintas 67c8dd7
fix react 18 unit test
JCQuintas f951e15
Revert "Revert "remove unnecessary async""
JCQuintas 6603ffc
split editing keyboard
JCQuintas 0579e1a
fix isolate browser
JCQuintas c564086
Merge commit '586a1c21edac8e2fb10d39548e998df658907a71' into vitest-x…
JCQuintas fa52763
remove overrides
JCQuintas f766204
revert hijri changes
JCQuintas be3a31f
revert hijri changes
JCQuintas 6484f59
fix removing keys
JCQuintas 3aa733b
Merge commit '3d7e504636461c485c798a32d9c2a7be760f9fb8' into vitest-x…
JCQuintas 0758884
vitest upgrade
JCQuintas cf9d282
fixes
JCQuintas 472e323
fix interaction
JCQuintas 90a37c6
fix date
JCQuintas 06c8e47
fixes
JCQuintas a2f15b7
fix re-render issue on use series
JCQuintas 088dbc8
fix act warnings
JCQuintas 9782168
Merge branch 'master' into vitest-x-browser-working
JCQuintas 5f001e3
fix act warnings
JCQuintas 4c71514
allow trigger none tooltip
JCQuintas 6900304
fix grid test
JCQuintas f0465b5
fix heatmap tooltip issue on hooks
JCQuintas 9cadb47
use v8 coverage
JCQuintas 0f9a1e1
dedupe
JCQuintas 0e5d7d4
remove istanbul
JCQuintas 6881ecf
how fast goes fast
JCQuintas 1014ffe
remove paralelism
JCQuintas bf2d395
fix workers
JCQuintas bf91c4d
min/max workers
JCQuintas 66827f1
large runner
JCQuintas 8b97b4f
large
JCQuintas 4a94b0f
large
JCQuintas 94f5179
medium
JCQuintas 046d9a5
lcov only in ci
JCQuintas ff4839f
remove useless file
JCQuintas 694ff3c
run coverage only on browser react-stable
JCQuintas cabde14
m+ browser
JCQuintas dbd7618
browser medium cov
JCQuintas 655dc9c
try hanging reporters
JCQuintas 2c2cffe
revert change
JCQuintas e6bf33d
Merge commit 'a95be3e3630038372947b1e0ce86f3bd076f64de' into vitest-x…
JCQuintas 72469d5
hanging process
JCQuintas 5798225
run again
JCQuintas d4f7602
Merge commit '4029bd44ddb20dd6d234ca653a3a1307ce899801' into vitest-x…
JCQuintas f2e674e
Merge commit '077fef10704956b8463e014816486712b95dfdea' into vitest-x…
JCQuintas 818eb96
revert change
JCQuintas 1c823e7
try debug
JCQuintas cf44d28
debug
JCQuintas 60b754f
dot reporter
JCQuintas 2bfe2fa
Merge commit '57e61921452fa97ee430580895da54bf4bd94e85' into vitest-x…
JCQuintas 6651e15
config
JCQuintas cb69c03
Merge commit '8e9f30168042adb6dc979d74087c53e955cfed85' into vitest-x…
JCQuintas 8b49daa
heatmap async
JCQuintas 90d399d
Merge branch 'master' into vitest-x-browser-working
JCQuintas c653d01
try newer node
JCQuintas 7ccff0e
try vmthreads
JCQuintas 21effe6
reverts
JCQuintas b118a0c
Merge commit '3d47060e773edb4a5dc86e13a97aa876638fd7fb' into vitest-x…
JCQuintas 9442953
medium+ browser
JCQuintas 63bebdf
codecov browser
JCQuintas e6a59b1
fixes
JCQuintas 09d6c38
use v8 ignore instead of istambul
JCQuintas e16d6af
Merge commit '02b7334fb5b2169d666ad96c2b4fc796d2cebcf0' into vitest-x…
JCQuintas 9a85e68
comment code again
JCQuintas c87bf05
Merge commit '14324de82af267a39626cb02575f624011bc59d9' into vitest-x…
JCQuintas 013aa2f
revert changes
JCQuintas f95e878
Merge commit '128c20ff0d5ba05b05edaec69fbf8135c0d54c71' into vitest-x…
JCQuintas 9e9a147
use esbuild keepnames
JCQuintas eace5e8
Merge commit '086e9549901463ab3e5838407e381722a47e5a86' into vitest-x…
JCQuintas 32f8f68
fix quickfilter
JCQuintas 20dc412
add waitfor
JCQuintas 5b5923e
fix
JCQuintas c761c7e
stub
JCQuintas 1e6e65b
stub matchmedia
JCQuintas bc599b7
change usage
JCQuintas 91fb565
revert react18 changes
JCQuintas eae931a
proper v8 ignore
JCQuintas 1611caa
Merge branch 'master' into vitest-x-browser-working
JCQuintas ae3804a
fix codecov config for adapters
JCQuintas 3011fe3
Merge branch 'master' into vitest-x-browser-working
JCQuintas 31bb49e
Merge commit '8403fe1dc8c3f6e6f6ef0b424fb61da8a01d8c32' into vitest-x…
JCQuintas 48f6df6
Merge commit '56a53a2126a1ea3496a748d514d2628936ca4366' into vitest-x…
JCQuintas b38e76a
Merge commit '4ef31c5dc9af315a0e507869ec35661860dfad3d' into vitest-x…
JCQuintas f2d771b
fix vitest
JCQuintas 0edd8c6
Merge commit 'bcfea2ec18ae8bdc2f0f4cb0f7c58197f49007a6' into vitest-x…
JCQuintas 4c134dd
Merge branch 'master' into vitest-x-browser-working
JCQuintas 1dee4a5
Merge commit '9e4fc87b92ec2a0ce276c95a00e670e9f828cca2' into vitest-x…
JCQuintas 83fee2c
revert
JCQuintas 0486002
remove
JCQuintas f8875b5
await
JCQuintas 4de744b
fix timeout
JCQuintas a6c43c2
fix chart test
JCQuintas a2f0118
remove unnecessary fake time
JCQuintas 8a71d26
wait for
JCQuintas 60abcae
fix imports
JCQuintas 8eefc86
Merge commit '6a85377776e7703e43e709edd12ce17e48205387' into vitest-x…
JCQuintas 30c0a78
merge charts changes
JCQuintas df32df6
fix zoom tests
JCQuintas d00f23f
system time
JCQuintas aa48514
styling
JCQuintas 5b84db7
Merge commit 'b850e86595e9cfce4312f88213b567707ca5ae5d' into vitest-x…
JCQuintas 7688c24
improve ishydrated
JCQuintas 2099068
fix data
JCQuintas ba95ff2
merge
JCQuintas ad3f611
Merge commit 'cac327103f8ebe7434955a94d6cdfdd8f5974a47' into vitest-x…
JCQuintas 8a035c9
changes
JCQuintas 43e690f
fix new changes and versions
JCQuintas 2d7f73a
fixes
JCQuintas 92e7a5d
Merge commit 'dbfc3fea456bd5d73ea8712d9f43368857cdc102' into vitest-x…
JCQuintas f488dc0
dedupe
JCQuintas 5e9bc5f
Revert changes and add global cleanup
JCQuintas 4884ea0
revert
JCQuintas 14d13d6
react 18 errors
JCQuintas 8cc7625
remove waitfor
JCQuintas b980147
reset
JCQuintas 72b65f7
remove unused file
JCQuintas bff64d3
Add minimum for hijri tests to work in vitest browser
JCQuintas 58e2122
try wait for
JCQuintas 8d279c2
Merge commit 'cb6ae5571c5de70cfea80580553702acdc92be26' into vitest-x…
JCQuintas f429669
Fix datagrid changes
JCQuintas fea979f
scripts
JCQuintas 87c54ae
remove config
JCQuintas 3082de9
clear cache after run
JCQuintas 835754e
fix changes
JCQuintas 06c71de
update scripts
JCQuintas 702b3f9
revert clearwarning changes
JCQuintas 89c7309
Try defined size
JCQuintas 1e72fe9
Merge commit 'f8f131e9a4fe4bbee0347cbb82156ff2629f2938' into vitest-x…
JCQuintas f9c5136
increase parent size
JCQuintas f01ec53
change script names
JCQuintas f1eb72c
change test behavior
JCQuintas 300280b
add todo
JCQuintas a2c8da2
Merge commit '08e50e5b5863391c9375c8b22816ddb3c9a971a4' into vitest-x…
JCQuintas 1b9aa40
Merge commit 'ae8e2fb361dfa97615fe56c6ff2feeed3864896c' into vitest-x…
JCQuintas 7af50b2
improve dx
JCQuintas 350a520
Revert "random"
JCQuintas a3fa338
lockfile
JCQuintas 59a34ff
Merge commit '7d52f102ec9a691746d0959ebab7e8815473a8a6' into vitest-x…
JCQuintas eea2b4f
Revert "timer reversals"
JCQuintas e45be58
fix date
JCQuintas 58bc33b
Revert "possible changes"
JCQuintas 905fdc8
fix
JCQuintas 4ddaa3e
fix
JCQuintas b9221d2
change date
JCQuintas 5578a65
use vite timers
JCQuintas f0ae783
Merge commit '870970914f72539a93231181d0ab6b89903f9e4e' into vitest-x…
JCQuintas 6844bd0
Merge commit '8f0728b2269a96939a4a6b5045e4bf5bd8c18be8' into vitest-x…
JCQuintas 3da419f
Revert to use vi timers
JCQuintas 6695614
improvements
JCQuintas 48ba1db
mergein
JCQuintas 8b11847
suggestions
JCQuintas b03ee5b
change msg
JCQuintas 23ab3c2
dedupe
JCQuintas b8b510b
add back
JCQuintas 62561b6
suggestions
JCQuintas 46c7c34
address scripts comments
JCQuintas ce34df4
Merge commit 'c25066404f6e0ed4a02ebc63d483597894a29c46' into vitest-x…
JCQuintas 8b35b39
suggestions
JCQuintas 65fe98d
re-enable pickers test that was failing
JCQuintas f158e0e
reverts
JCQuintas 2877d64
Merge commit '53fd0e32860985c6629346ffd844dd674a78ddb1' into vitest-x…
JCQuintas ef3a9bd
vitest redirect imports
JCQuintas fb13349
exclude -> include
JCQuintas b87e324
Update test/vite-plugin-filter-replace.mts
JCQuintas 46a2b70
move includes to prop of config
JCQuintas b6d49c6
change to single include and document
JCQuintas cd8161d
add /locale back
JCQuintas fce7e7a
formatting
JCQuintas dc5e792
Merge commit 'c3fe709fe61282c152fbbdc0bc812080ec6e9fc3' into vitest-x…
JCQuintas b981102
prettier
JCQuintas 480de46
simple projects names
JCQuintas 73c6a59
Merge branch 'master' into vitest-x-browser-working
JCQuintas 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -105,30 +105,6 @@ module.exports = function getBabelConfig(api) { | |
], | ||
]; | ||
|
||
if (process.env.NODE_ENV === 'test') { | ||
plugins.push(['@babel/plugin-transform-export-namespace-from']); | ||
// We replace `date-fns` imports with an aliased `date-fns@v2` version installed as `date-fns-v2` for tests. | ||
plugins.push([ | ||
'babel-plugin-replace-imports', | ||
{ | ||
test: /date-fns/i, | ||
replacer: 'date-fns-v2', | ||
// This option is provided by the `patches/[email protected]` patch | ||
filenameIncludes: 'src/AdapterDateFnsV2/', | ||
}, | ||
]); | ||
plugins.push([ | ||
'babel-plugin-replace-imports', | ||
{ | ||
test: /date-fns-jalali/i, | ||
replacer: 'date-fns-jalali-v2', | ||
// This option is provided by the `patches/[email protected]` patch | ||
filenameIncludes: 'src/AdapterDateFnsJalaliV2/', | ||
}, | ||
'replace-date-fns-jalali-imports', | ||
]); | ||
} | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
if (!process.env.TEST_BUILD) { | ||
plugins.push(['babel-plugin-react-remove-properties', { properties: ['data-testid'] }]); | ||
|
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { mergeConfig, defineProject } from 'vitest/config'; | ||
import sharedConfig from '../vitest.shared.mts'; | ||
import { getTestName } from '../scripts/getTestName.mts'; | ||
|
||
export default mergeConfig( | ||
sharedConfig, | ||
defineProject({ | ||
test: { | ||
name: getTestName(import.meta.url), | ||
environment: 'jsdom', | ||
}, | ||
}), | ||
); |
This file contains hidden or 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,11 +1,15 @@ | ||
export {}; // Ensure this file is treated as a module to avoid global scope TS error | ||
|
||
declare global { | ||
interface MUIEnv { | ||
NODE_ENV?: string; | ||
} | ||
|
||
interface Process { | ||
env: MUIEnv; | ||
} | ||
|
||
// support process.env.NODE_ENV === '...' | ||
// @ts-ignore | ||
const process: { | ||
env: { | ||
NODE_ENV?: string; | ||
}; | ||
}; | ||
const process: Process; | ||
} |
This file contains hidden or 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 |
---|---|---|
|
@@ -32,14 +32,12 @@ | |
"proptypes": "tsx ./docs/scripts/generateProptypes.ts", | ||
"size:snapshot": "node --max-old-space-size=2048 ./scripts/sizeSnapshot/create", | ||
"size:why": "pnpm size:snapshot --analyze --accurateBundles", | ||
"tc": "node test/cli.js", | ||
"test": "node scripts/test.mjs", | ||
"test:coverage": "cross-env NODE_OPTIONS=--max-old-space-size=4096 NODE_ENV=test TZ=UTC BABEL_ENV=coverage nyc mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}' && nyc report -r lcovonly", | ||
"test:coverage:html": "cross-env NODE_ENV=test TZ=UTC BABEL_ENV=coverage nyc mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}' && nyc report --reporter=html", | ||
"test:coverage:inspect": "cross-env NODE_ENV=test TZ=UTC BABEL_ENV=coverage mocha --inspect-brk", | ||
"test:karma": "cross-env NODE_ENV=test TZ=UTC karma start test/karma.conf.js", | ||
"test:karma:parallel": "cross-env NODE_ENV=test TZ=UTC PARALLEL=true karma start test/karma.conf.js", | ||
"test:unit": "cross-env NODE_ENV=test TZ=UTC mocha -n expose_gc 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}'", | ||
"test": "pnpm test:unit:jsdom", | ||
"test:jsdom": "pnpm test:unit:jsdom", | ||
"test:unit": "pnpm test:unit:jsdom", | ||
"test:unit:jsdom": "cross-env NODE_ENV=test TZ=UTC JSDOM=true vitest", | ||
"test:browser": "pnpm test:unit:browser", | ||
"test:unit:browser": "cross-env NODE_ENV=test TZ=UTC BROWSER=true vitest", | ||
"test:e2e": "pnpm run release:build && cd test/e2e && pnpm run start", | ||
"test:e2e-website": "npx playwright test test/e2e-website --config test/e2e-website/playwright.config.ts", | ||
"test:e2e-website:dev": "PLAYWRIGHT_TEST_BASE_URL=http://localhost:3001 npx playwright test test/e2e-website --config test/e2e-website/playwright.config.ts", | ||
|
@@ -99,7 +97,6 @@ | |
"@playwright/test": "^1.52.0", | ||
"@types/babel__core": "^7.20.5", | ||
"@types/babel__traverse": "^7.20.7", | ||
"@types/chai": "^4.3.20", | ||
"@types/chai-dom": "^1.11.3", | ||
"@types/fs-extra": "^11.0.4", | ||
"@types/karma": "^6.3.9", | ||
|
@@ -113,6 +110,9 @@ | |
"@types/yargs": "^17.0.33", | ||
"@typescript-eslint/eslint-plugin": "^8.31.1", | ||
"@typescript-eslint/parser": "^8.31.1", | ||
"@vitejs/plugin-react": "^4.3.2", | ||
"@vitest/browser": "^3.1.2", | ||
"@vitest/coverage-v8": "^3.1.2", | ||
"@vvago/vale": "^3.11.2", | ||
"autoprefixer": "^10.4.21", | ||
"axe-core": "4.10.3", | ||
|
@@ -121,7 +121,6 @@ | |
"babel-plugin-module-resolver": "^5.0.2", | ||
"babel-plugin-optimize-clsx": "^2.6.2", | ||
"babel-plugin-react-remove-properties": "^0.3.0", | ||
"babel-plugin-replace-imports": "^1.0.2", | ||
"babel-plugin-search-and-replace": "^1.1.1", | ||
"babel-plugin-transform-inline-environment-variables": "^0.4.4", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24", | ||
|
@@ -135,6 +134,7 @@ | |
"danger": "^13.0.4", | ||
"date-fns-jalali-v2": "npm:[email protected]", | ||
"date-fns-v2": "npm:[email protected]", | ||
"esbuild": "^0.25.3", | ||
"eslint": "^8.57.1", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
|
@@ -169,6 +169,7 @@ | |
"karma-webpack": "^5.0.1", | ||
"lerna": "^8.2.2", | ||
"lodash": "^4.17.21", | ||
"magic-string": "^0.30.17", | ||
"markdownlint-cli2": "^0.17.2", | ||
"mocha": "^11.2.2", | ||
"moment": "^2.30.1", | ||
|
@@ -192,6 +193,8 @@ | |
"unist-util-visit": "^5.0.0", | ||
"util": "^0.12.5", | ||
"vite": "^6.3.4", | ||
"vitest": "3.1.2", | ||
"vitest-fail-on-console": "^0.7.1", | ||
"webpack": "^5.99.7", | ||
"webpack-bundle-analyzer": "^4.10.2", | ||
"webpack-cli": "^6.0.1", | ||
|
@@ -204,8 +207,7 @@ | |
}, | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"[email protected]": "patches/[email protected]", | ||
"[email protected]": "patches/[email protected]" | ||
"[email protected]": "patches/[email protected]" | ||
}, | ||
"onlyBuiltDependencies": [ | ||
"@swc/core", | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// <reference types="@vitest/browser/providers/playwright" /> | ||
import { mergeConfig } from 'vitest/config'; | ||
import sharedConfig from '../../vitest.shared.mts'; | ||
import { getTestName } from '../../scripts/getTestName.mts'; | ||
|
||
export default mergeConfig(sharedConfig, { | ||
test: { | ||
name: getTestName(import.meta.url), | ||
environment: 'browser', | ||
browser: { | ||
enabled: true, | ||
instances: [ | ||
{ | ||
browser: 'chromium', | ||
}, | ||
], | ||
}, | ||
}, | ||
}); |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { mergeConfig } from 'vitest/config'; | ||
import sharedConfig from '../../vitest.shared.mts'; | ||
import { getTestName } from '../../scripts/getTestName.mts'; | ||
|
||
export default mergeConfig(sharedConfig, { | ||
test: { | ||
name: getTestName(import.meta.url), | ||
environment: 'jsdom', | ||
}, | ||
}); |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// <reference types="@vitest/browser/providers/playwright" /> | ||
import { mergeConfig } from 'vitest/config'; | ||
import sharedConfig from '../../vitest.shared.mts'; | ||
import { getTestName } from '../../scripts/getTestName.mts'; | ||
|
||
export default mergeConfig(sharedConfig, { | ||
test: { | ||
name: getTestName(import.meta.url), | ||
environment: 'browser', | ||
browser: { | ||
enabled: true, | ||
instances: [ | ||
{ | ||
browser: 'chromium', | ||
}, | ||
], | ||
}, | ||
}, | ||
}); |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { mergeConfig } from 'vitest/config'; | ||
import sharedConfig from '../../vitest.shared.mts'; | ||
import { getTestName } from '../../scripts/getTestName.mts'; | ||
|
||
export default mergeConfig(sharedConfig, { | ||
test: { | ||
name: getTestName(import.meta.url), | ||
environment: 'jsdom', | ||
}, | ||
}); |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// <reference types="@vitest/browser/providers/playwright" /> | ||
import { mergeConfig } from 'vitest/config'; | ||
import sharedConfig from '../../vitest.shared.mts'; | ||
import { getTestName } from '../../scripts/getTestName.mts'; | ||
|
||
export default mergeConfig(sharedConfig, { | ||
test: { | ||
name: getTestName(import.meta.url), | ||
environment: 'browser', | ||
browser: { | ||
enabled: true, | ||
instances: [ | ||
{ | ||
browser: 'chromium', | ||
}, | ||
], | ||
}, | ||
}, | ||
}); |
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.
Both of these scripts were mainly maintained and used by @oliviertassinari.
After these changes, they seem to be partially no longer needed, hence, they could be removed.
However, am I missing something @JCQuintas, or is Vitest simply much slower at grep filtering tests? 🤔


Below are the results of running
pnpm test --testNamePattern=DateRangePicker
vspnpm test:unit --grep DateRangePicker
:Given these differences, pattern matching test no longer seems like a viable option. 🙈
Side nitpick: Would it make sense to keep the existing
test:unit
script to ensure that muscle memory usage still works for everybody? 🙈 😆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 guess the
--testNamePattern=
makes it slow somehow 😆if you just run

pnpm test DateRangePicker
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.
removed the scripts
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.
That's strange... 🙈
I reckon this will need some getting used to and unlearning old habits. 🤔 🙈
Uh oh!
There was an error while loading. Please reload this page.
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.
pnpm tc
?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 currently use
describe.only
orit.only
ortest:unit --grep <pattern>
.Didn't see the need for anything else for now... 🤷
Uh oh!
There was an error while loading. Please reload this page.
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.
The need was to support the work on around 10 PRs a day, most as reviews of others work. I would most often verify that the test was failing without the fix, and add missing tests. I couldn't stand to checkout a branch and wait a long time for the tests the PR changes to run. Usually when changing branches watch mode would break, you had to restart it.
pnpm tc
purpose was to allow to run the tests in < 10s.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.
As far as I understand
pnpm tc
andpnpm vitest
are comparable. In the examples below I'm runningtc
in--single
mode to prevent watch, andtest:jsdom
withCI=true
to also prevent watch.Keep in mind if I use
tc
without the--single
it is erroring with "too many watchers", while vitest works out of the box.Uh oh!
There was an error while loading. Please reload this page.
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.
Alright, so does it mean that we can update https://github.com/mui/material-ui/blob/HEAD/test/README.md#getting-started with something equivalent?
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.
Eventually, yes, that is the goal. But this PR is for the X repo, not material