Skip to content

Commit 6674e49

Browse files
authored
ci(): Migrate jest to vitest (#10420)
1 parent e24d888 commit 6674e49

File tree

79 files changed

+2947
-3928
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2947
-3928
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,21 @@ jobs:
9595
uses: ./.github/actions/build-fabric-cached
9696
- name: Run ${{ matrix.suite }} tests
9797
run: npm run test -- -c node -s ${{ matrix.suite }}
98-
jest:
99-
name: Jest tests
98+
vitest:
99+
name: Vitest tests
100100
runs-on: ubuntu-24.04
101101
steps:
102102
- uses: actions/checkout@v4
103103
- uses: ./.github/actions/cached-install
104104
with:
105105
node-version: 20.x
106106
install-system-deps: false
107-
- name: Run Jest unit test
108-
run: npm run test:jest:coverage
107+
- name: Run Vitest unit test
108+
run: npm run test:vitest:coverage
109109
- name: Upload test coverage
110110
uses: actions/upload-artifact@v4
111111
with:
112-
name: coverage-jest
112+
name: coverage-vitest
113113
path: ./.nyc_output/*.json
114114
include-hidden-files: true
115115

@@ -158,7 +158,7 @@ jobs:
158158
path: ./.nyc_output
159159
- uses: actions/download-artifact@v4
160160
with:
161-
name: coverage-jest
161+
name: coverage-vitest
162162
path: ./.nyc_output
163163
- uses: actions/download-artifact@v4
164164
with:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [next]
44

5+
- ci(): Switch from Jest to Vitest [#10420](https://github.com/fabricjs/fabric.js/pull/10420)
56
- chore(): Update canvas and jsdom [#10417](https://github.com/fabricjs/fabric.js/pull/10417)
67

78
## [6.6.2]

CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ It is more than likely you will be requested to change stuff and refine your wor
129129
[![🧪](../../actions/workflows/tests.yml/badge.svg)](../../actions/workflows/tests.yml)
130130
[![CodeQL](../../actions/workflows/codeql-analysis.yml/badge.svg)](../../actions/workflows/codeql-analysis.yml)
131131

132-
| Suite | unit (node) | e2e (browser) |
133-
| ------------------------------------------------------------------------------------------------------------- | :--------------------------------------------- | :----------------------------------------------------------------------------------- |
134-
| Framework | [`jest`][jest] | [`playwright`][playwright] |
135-
| Setup | | <pre>npm run build -- -f -w</pre> |
136-
| Running Tests<br><br><pre>\<test cmd\> -- [filter] [watch]</pre><br>It is advised to use filters to save time | <pre>npm run test:jest -- [filters] [-w]</pre> | <pre>npm run test:e2e -- [filters] [--ui]</pre> |
137-
| Writing Tests | Add/update `src/*.(spec\|test).ts` files | - Update tests in `e2e/tests`<br>- Create a new test based on `e2e/template` |
138-
| Test Gen | | <pre>npm start vanilla<br>npx playwright codegen http://localhost:1234</pre> |
139-
| Test Spec | | - `index.ts`: built and loaded into the web app<br> - `index.spec.ts`: test spec<br> |
140-
| Outputs | Snapshots next to the test file | - Snapshots next to the test file <br>- `e2e/test-report`<br>- `e2e/test-results` |
132+
| Suite | unit (node) | e2e (browser) |
133+
| ------------------------------------------------------------------------------------------------------------- | :----------------------------------------------- | :----------------------------------------------------------------------------------- |
134+
| Framework | [`vitest`][vitest] | [`playwright`][playwright] |
135+
| Setup | | <pre>npm run build -- -f -w</pre> |
136+
| Running Tests<br><br><pre>\<test cmd\> -- [filter] [watch]</pre><br>It is advised to use filters to save time | <pre>npm run test:vitest -- [filters] [-w]</pre> | <pre>npm run test:e2e -- [filters] [--ui]</pre> |
137+
| Writing Tests | Add/update `src/*.(spec\|test).ts` files | - Update tests in `e2e/tests`<br>- Create a new test based on `e2e/template` |
138+
| Test Gen | | <pre>npm start vanilla<br>npx playwright codegen http://localhost:1234</pre> |
139+
| Test Spec | | - `index.ts`: built and loaded into the web app<br> - `index.spec.ts`: test spec<br> |
140+
| Outputs | Snapshots next to the test file | - Snapshots next to the test file <br>- `e2e/test-report`<br>- `e2e/test-results` |
141141

142142
### Legacy Test Suite
143143

@@ -266,7 +266,7 @@ Don't forget to unlink the package once you're done.
266266
[jsdoc]: https://jsdoc.app/
267267
[tsjsdoc]: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
268268
[playwright]: https://playwright.dev/
269-
[jest]: https://jestjs.io/
269+
[vitest]: https://vitest.dev/
270270
[qunit]: https://qunitjs.com/
271271
[testem]: https://github.com/testem/testem
272272
[unit_test]: https://github.com/fabricjs/fabric.js/blob/93dd2dcca705a4b481fbc9982da4952ef5b4ed1d/test/unit/point.js#L227-L237

babel-jest.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default [
3939
console: 'readonly',
4040
},
4141
parserOptions: {
42-
project: true,
42+
project: 'tsconfig.spec.json',
4343
tsconfigRootDir: './',
4444
},
4545
},

fabric.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export { loadSVGFromString } from './src/parser/loadSVGFromString';
176176
export { loadSVGFromURL } from './src/parser/loadSVGFromURL';
177177
export { parseSVGDocument } from './src/parser/parseSVGDocument';
178178

179-
// todo convert tests to jest and stop exporting those.
179+
// todo convert tests to vitest and stop exporting those.
180180
export { parseAttributes } from './src/parser/parseAttributes';
181181
export { parseStyleAttribute } from './src/parser/parseStyleAttribute';
182182
export { parsePointsAttribute } from './src/parser/parsePointsAttribute';

jest-env/index.ts

Lines changed: 0 additions & 207 deletions
This file was deleted.

0 commit comments

Comments
 (0)