Skip to content

Commit 5dfc897

Browse files
committed
tests: Migrate to Vitest
1 parent 9e3034a commit 5dfc897

File tree

10 files changed

+1167
-4583
lines changed

10 files changed

+1167
-4583
lines changed

babel.config.js

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

jest.config.js

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

package.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"scripts": {
77
"start": "vite",
88
"build": "node scripts/build.js",
9-
"test": "jest --watch",
10-
"test:ci": "jest -i --ci -b",
9+
"test": "vitest",
10+
"test:ci": "vitest run --coverage --no-file-parallelism --bail 1",
1111
"lint": "eslint --ext .js,vue src",
1212
"prepublishOnly": "yarn build",
1313
"docs:dev": "vitepress dev docs",
@@ -27,27 +27,25 @@
2727
"@radial-color-picker/rotator": "3.0.2"
2828
},
2929
"devDependencies": {
30-
"@babel/core": "7.14.8",
3130
"@size-limit/file": "11.0.2",
32-
"@vitejs/plugin-vue": "5.0.3",
33-
"@vue/babel-preset-app": "4.3.1",
31+
"@vitejs/plugin-vue": "5.0.4",
32+
"@vitest/coverage-v8": "1.3.1",
3433
"@vue/compiler-sfc": "3.4.15",
35-
"@vue/test-utils": "2.0.0-rc.11",
36-
"babel-jest": "26.6.3",
34+
"@vue/test-utils": "2.4.4",
3735
"chalk": "4.1.2",
3836
"cliui": "7.0.4",
3937
"eslint": "8.57.0",
4038
"eslint-plugin-vue": "9.22.0",
4139
"fs-extra": "10.0.0",
4240
"husky": "9.0.11",
43-
"jest": "26.6.3",
41+
"jsdom": "24.0.0",
4442
"lint-staged": "15.2.2",
4543
"prettier": "3.2.5",
4644
"size-limit": "11.0.2",
47-
"vite": "5.0.12",
45+
"vite": "5.1.4",
4846
"vitepress": "1.0.0-rc.40",
49-
"vue": "3.4.15",
50-
"vue-jest": "5.0.0-alpha.10"
47+
"vitest": "1.3.1",
48+
"vue": "3.4.15"
5149
},
5250
"peerDependencies": {
5351
"vue": "^3.0.0"

scripts/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const getBuildConfig = ({ formats, minify }) => {
5858

5959
console.log('Building for production as library (commonjs, es, umd, umd-min)...');
6060

61-
await build(getBuildConfig({ formats: ['es', 'cjs'] }));
61+
await build(getBuildConfig({ formats: ['es', 'cjs'], minify: false }));
6262
await build(getBuildConfig({ formats: ['umd'], minify: false }));
6363
await build(getBuildConfig({ formats: ['umd'], minify: true }));
6464

src/ColorPicker.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
22
<div
3-
ref="el"
43
role="slider"
54
:aria-roledescription="ariaRoledescription"
65
:aria-label="ariaLabel"
@@ -138,7 +137,7 @@
138137
);
139138
140139
// ignore testing code that will be removed by dead code elimination for production
141-
// istanbul ignore next
140+
/* v8 ignore next 5 */
142141
if (process.env.NODE_ENV === 'development' && props.initiallyCollapsed && props.variant === 'persistent') {
143142
console.warn(
144143
`Incorrect config: using variant="persistent" and :initiallyCollapsed="true" at the same time is not supported.`
@@ -147,7 +146,7 @@
147146
148147
onMounted(() => {
149148
// the Rorator module already has an extensive test suite
150-
// istanbul ignore next
149+
/* v8 ignore next 10 */
151150
rcp = new Rotator(rotator.value, {
152151
angle: angle.value,
153152
onRotate(hue) {
@@ -229,7 +228,6 @@
229228
rcp,
230229
231230
// refs
232-
el,
233231
rotator,
234232
235233
// state

tests/unit/.eslintrc.js

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

tests/unit/__snapshots__/index.spec.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`Init renders correctly 1`] = `
3+
exports[`Init > renders correctly 1`] = `
44
<div
55
aria-disabled="false"
66
aria-expanded="true"
@@ -16,7 +16,7 @@ exports[`Init renders correctly 1`] = `
1616
tabindex="0"
1717
>
1818
<div
19-
class="rcp__palette in"
19+
class="rcp__palette"
2020
/>
2121
<div
2222
class="rcp__rotator"

0 commit comments

Comments
 (0)