Skip to content

Commit

Permalink
chore: replace jest with vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD committed Sep 3, 2024
1 parent 115edca commit 1979fd7
Show file tree
Hide file tree
Showing 104 changed files with 997 additions and 1,838 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ jobs:
env:
SCOPES: ${{ matrix.scopes }}

test-jest:
name: Test (Jest)
test-unit:
name: Test (Unit)
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pnpm-install
- run: pnpm run test:coverage -i
- run: pnpm run test
working-directory: ./packages/vuetify

test-cypress:
name: Test (Cypress)
test-e2e:
name: Test (e2e)
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
Expand All @@ -94,7 +94,7 @@ jobs:
if-no-files-found: ignore

deploy:
needs: [lint, test-jest, test-cypress, build-vuetify]
needs: [lint, test-unit, test-e2e, build-vuetify]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/v') && github.repository_owner == 'vuetifyjs'
steps:
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
path: packages/docs/dist

publish-docs:
needs: [lint, test-jest, build-docs]
needs: [lint, test-unit, build-docs]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository_owner == 'vuetifyjs' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/next')
steps:
Expand Down
4 changes: 4 additions & 0 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ module.exports = {
if (['@rollup/pluginutils', 'rollup-plugin-terser', '@rollup/plugin-replace'].includes(pkg.name)) {
pkg.peerDependencies.rollup = '*'
}
if (pkg.name === 'brilliant-errors') {
delete pkg.dependencies.bumpp

This comment has been minimized.

Copy link
@johnleider

johnleider Sep 9, 2024

Member

should this be .bump?

This comment has been minimized.

Copy link
@KaelWD
delete pkg.dependencies.vitest
}
return pkg
}
}
Expand Down
2 changes: 1 addition & 1 deletion eslint-local-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
'no-components-index': require('./scripts/rules/no-components-index'),
'jsx-condition-key': require('./scripts/rules/jsx-condition-key'),
'jsx-curly-spacing': require('./scripts/rules/jsx-curly-spacing'),
'jest-global-imports': require('./scripts/rules/jest-global-imports'),
'vitest-global-imports': require('./scripts/rules/vitest-global-imports'),
'cypress-types-reference': require('./scripts/rules/cypress-types-reference'),
'sort-imports': require('./scripts/rules/sort-imports'),
'no-nullish-coalescing-in-condition': require('./scripts/rules/no-nullish-coalescing-in-condition'),
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"@vue/runtime-dom": "^3.4.27",
"@vueuse/head": "^1.3.1",
"babel-eslint": "^10.1.0",
"babel-jest": "^28.1.3",
"conventional-changelog-cli": "^3.0.0",
"conventional-changelog-vuetify": "^1.2.1",
"conventional-github-releaser": "^3.1.5",
Expand All @@ -66,10 +65,6 @@
"glob": "^11.0.0",
"husky": "^3.1.0",
"inquirer": "^6.5.2",
"jest": "^28.1.3",
"jest-cli": "^28.1.3",
"jest-environment-jsdom": "^28.1.3",
"jest-serializer-html": "^7.1.0",
"lerna": "^8.1.7",
"magic-string": "^0.30.9",
"mkdirp": "^3.0.1",
Expand All @@ -94,6 +89,9 @@
"pnpm": {
"patchedDependencies": {
"@mdi/js@7.4.47": "patches/@mdi__js@7.4.47.patch"
},
"overrides": {
"tough-cookie": "5.0.0-rc.4"
}
}
}
2 changes: 1 addition & 1 deletion packages/vuetify/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = {
plugins: ['jest'],
extends: ['plugin:jest/recommended'],
rules: {
'local-rules/jest-global-imports': 'error',
'local-rules/vitest-global-imports': 'error',

'no-restricted-imports': 'off',

Expand Down
6 changes: 3 additions & 3 deletions packages/vuetify/dev/vuetify.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/src/styles/main.sass'
import '@/styles/main.sass'

import { createVuetify } from 'vuetify/src/framework'
import * as directives from 'vuetify/src/directives'
import { createVuetify } from '@/framework'
import * as directives from '@/directives'

import date from './vuetify/date'
import defaults from './vuetify/defaults'
Expand Down
6 changes: 3 additions & 3 deletions packages/vuetify/dev/vuetify/icons.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { aliases } from 'vuetify/src/iconsets/mdi-svg'
import { mdi } from 'vuetify/src/iconsets/mdi'
import { fa } from 'vuetify/src/iconsets/fa-svg'
import { aliases } from '@/iconsets/mdi-svg'
import { mdi } from '@/iconsets/mdi'
import { fa } from '@/iconsets/fa-svg'

export default {
defaultSet: 'mdi',
Expand Down
2 changes: 1 addition & 1 deletion packages/vuetify/dev/vuetify/locale.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ar, en, ja, sv } from 'vuetify/src/locale'
import { ar, en, ja, sv } from '@/locale'

export default {
messages: {
Expand Down
10 changes: 0 additions & 10 deletions packages/vuetify/jest.config.js

This file was deleted.

12 changes: 5 additions & 7 deletions packages/vuetify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@
"build:lib": "NODE_ENV=lib babel src --out-dir lib --source-maps --extensions \".ts\",\".tsx\",\".snap\" --copy-files --no-copy-ignored --out-file-extension .mjs",
"build:types": "rimraf types-temp && tsc --pretty --emitDeclarationOnly -p tsconfig.dist.json && rollup --config build/rollup.types.config.mjs && rimraf types-temp",
"tsc": "tsc",
"debug:test": "NODE_ENV=test node --inspect --inspect-brk ../../node_modules/jest/bin/jest.js --no-cache -i --verbose",
"test": "node build/run-tests.js",
"test:unix": "NODE_ENV=test jest",
"test:win32": "NODE_ENV=test jest -i",
"test": "vitest",
"test:coverage": "pnpm run test --coverage",
"lint": "concurrently -n \"tsc,eslint\" --kill-others-on-fail \"tsc -p tsconfig.checks.json --noEmit --pretty\" \"eslint src -f codeframe --max-warnings 0\"",
"lint:fix": "concurrently -n \"tsc,eslint\" \"tsc -p tsconfig.checks.json --noEmit --pretty\" \"eslint --fix src\"",
Expand All @@ -126,18 +123,17 @@
"@fortawesome/fontawesome-svg-core": "^6.5.2",
"@fortawesome/free-solid-svg-icons": "^6.5.2",
"@fortawesome/vue-fontawesome": "^3.0.6",
"@jest/globals": "^28.1.3",
"@percy/cli": "^1.28.2",
"@percy/cypress": "^3.1.2",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@types/jest": "^28.1.8",
"@types/node": "^20.12.7",
"@types/resize-observer-browser": "^0.1.11",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vitest/coverage-v8": "^2.0.5",
"@vue/babel-plugin-jsx": "^1.2.2",
"@vue/shared": "^3.4.27",
"@vue/test-utils": "2.4.6",
Expand All @@ -161,7 +157,7 @@
"expect": "^28.1.3",
"fast-glob": "^3.3.2",
"identity-obj-proxy": "^3.0.0",
"jest-canvas-mock": "^2.5.2",
"jsdom": "^25.0.0",
"micromatch": "^4.0.5",
"postcss": "^8.4.38",
"rollup": "^3.20.7",
Expand All @@ -170,10 +166,12 @@
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"timezone-mock": "^1.3.6",
"unplugin-auto-import": "0.17.5",
"unplugin-vue-components": "^0.27.4",
"upath": "^2.0.1",
"vite": "^5.4.0",
"vite-ssr": "^0.17.1",
"vitest": "^2.0.5",
"vue-i18n": "^9.7.1",
"vue-router": "^4.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/vuetify/src/__tests__/framework.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Utilities
import { describe, expect, it } from '@jest/globals'
import { mount } from '@vue/test-utils'
import { expect, it } from 'vitest'
import { createVuetify } from '@/framework'

describe('framework', () => {
Expand Down
17 changes: 17 additions & 0 deletions packages/vuetify/src/auto-imports.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
export {}
declare global {
const afterAll: typeof import('vitest')['afterAll']
const afterEach: typeof import('vitest')['afterEach']
const assert: typeof import('vitest')['assert']
const beforeAll: typeof import('vitest')['beforeAll']
const beforeEach: typeof import('vitest')['beforeEach']
const describe: typeof import('vitest')['describe']
const expect: typeof import('vitest')['expect']
const it: typeof import('vitest')['it']
const vi: typeof import('vitest')['vi']
}
13 changes: 13 additions & 0 deletions packages/vuetify/src/components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}

/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Utilities
import { describe, expect, it } from '@jest/globals'
import { expect, it } from 'vitest'
import { extractColor } from '../'

const red = { h: 0, s: 1, v: 1, a: 1 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
// import Vue from 'vue'
// import { Lang } from '../../../services/lang'
// import { preset } from '../../../presets/default'
// import { resizeWindow } from '../../../../test'
// import { resizeWindow } from '@/../test'

// Vue.prototype.$vuetify = {
// icons: {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createHeaders } from '../composables/headers'

// Utilities
import { describe, expect, it } from '@jest/globals'
import { expect, it } from 'vitest'
import { createHeaders } from '../composables/headers'

describe('VDataTable headers', () => {
it('flattens 2d headers', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { transformItems as _transformItems } from '../composables/items'
import { sortItems as _sortItems } from '../composables/sort'

// Utilities
import { describe, expect, it } from '@jest/globals'
import { mount } from '@vue/test-utils'
import { expect, it } from 'vitest'

// Types
import type { SortItem } from '../composables/sort'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-nocheck
/* eslint-disable */

// import { touch } from '../../../../test'
// import { touch } from '@/../test'
import {
mount,
MountOptions,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1979fd7

Please sign in to comment.