Skip to content

Commit

Permalink
[test] Use vite and vitest for e2e and regression tests (#1127)
Browse files Browse the repository at this point in the history
Co-authored-by: Michał Dudak <[email protected]>
  • Loading branch information
mj12albert and michaldudak authored Jan 4, 2025
1 parent 58434ca commit 9fb1b40
Show file tree
Hide file tree
Showing 34 changed files with 748 additions and 813 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
react-version: << parameters.react-version >>
- run:
name: Run tests on JSDOM
command: pnpm test:jsdom --coverage
command: pnpm test:jsdom --coverage --project @base-ui-components/react --project docs
- run:
name: Check if coverage report is generated
command: |
Expand Down Expand Up @@ -290,7 +290,7 @@ jobs:
browsers: true
- run:
name: Run tests on headless Chromium
command: pnpm test:chromium --coverage
command: pnpm test:chromium --coverage --project @base-ui-components/react --project docs
- run:
name: Check if coverage report is generated
command: |
Expand Down
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,12 @@ module.exports = {
'@typescript-eslint/no-use-before-define': 'off',
},
},
{
files: ['test/**/*{.ts,.tsx}'],
rules: {
'react/prop-types': 'off',
'guard-for-in': 'off',
},
},
],
};
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@
"test:coverage:ci": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=lcov mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}'",
"test:coverage:html": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=html mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}'",
"test:e2e": "cross-env NODE_ENV=production pnpm test:e2e:build && concurrently --success first --kill-others \"pnpm test:e2e:run\" \"pnpm test:e2e:server\"",
"test:e2e:build": "webpack --config test/e2e/webpack.config.js",
"test:e2e:dev": "concurrently \"pnpm test:e2e:build --watch\" \"pnpm test:e2e:server\"",
"test:e2e:run": "mocha --config test/e2e/.mocharc.js 'test/e2e/**/*.test.{js,ts,tsx}'",
"test:e2e:server": "serve test/e2e -p 5001",
"test:e2e:build": "vite build --config test/e2e/vite.config.mjs",
"test:e2e:dev": "vite --config test/e2e/vite.config.mjs -l info",
"test:e2e:run": "cross-env VITEST_ENV=chromium vitest --project e2e",
"test:e2e:server": "serve test/e2e -p 5173",
"test:karma": "cross-env NODE_ENV=test karma start test/karma.conf.js",
"test:karma:profile": "cross-env NODE_ENV=test karma start test/karma.conf.profile.js",
"test:regressions": "cross-env NODE_ENV=production pnpm test:regressions:build && concurrently --success first --kill-others \"pnpm test:regressions:run\" \"pnpm test:regressions:server\"",
"test:regressions:build": "pnpm release:build && webpack --config test/regressions/webpack.config.js",
"test:regressions:dev": "concurrently \"pnpm test:regressions:build --watch\" \"pnpm test:regressions:server\"",
"test:regressions:run": "mocha --config test/regressions/.mocharc.js --delay 'test/regressions/**/*.test.js'",
"test:regressions:server": "serve test/regressions -p 5001",
"test:regressions:build": "vite build --config test/regressions/vite.config.mjs",
"test:regressions:dev": "vite --config test/regressions/vite.config.mjs",
"test:regressions:run": "cross-env VITEST_ENV=chromium vitest --project regressions",
"test:regressions:server": "serve test/regressions -p 5173",
"test:unit": "cross-env NODE_ENV=test mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}'",
"test:jsdom": "cross-env NODE_ENV=test VITEST_ENV=jsdom vitest",
"test:chromium": "cross-env NODE_ENV=test VITEST_ENV=chromium vitest",
"test:firefox": "cross-env NODE_ENV=test VITEST_ENV=firefox vitest",
"test:jsdom": "cross-env NODE_ENV=test VITEST_ENV=jsdom vitest --project @base-ui-components/react --project docs",
"test:chromium": "cross-env NODE_ENV=test VITEST_ENV=chromium vitest --project @base-ui-components/react --project docs",
"test:firefox": "cross-env NODE_ENV=test VITEST_ENV=firefox vitest --project @base-ui-components/react --project docs",
"test:argos": "node ./scripts/pushArgos.mjs",
"typescript": "tsc -b tsconfig.json",
"validate-declarations": "tsx scripts/validateTypescriptDeclarations.mts",
Expand Down Expand Up @@ -169,6 +169,7 @@
"typescript": "^5.7.2",
"unist-util-visit": "^5.0.0",
"url-join": "4.0.1",
"vite": "^6.0.3",
"vitest": "^2.1.8",
"webpack": "^5.97.1",
"webpack-bundle-analyzer": "^4.10.2",
Expand Down
Loading

0 comments on commit 9fb1b40

Please sign in to comment.