Skip to content

Commit

Permalink
replace jest with vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLi committed Jan 20, 2024
1 parent 02f49c0 commit 6ab506c
Show file tree
Hide file tree
Showing 6 changed files with 824 additions and 2,085 deletions.
3 changes: 2 additions & 1 deletion app/components/image/calculateZoom.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { describe, beforeEach, afterEach, test, vi, expect } from 'vitest'
import calculateZoom from './calculateZoom'

describe('calculateZoom', () => {
let documentSpy

beforeEach(() => {
documentSpy = jest.spyOn(document, 'documentElement', 'get')
documentSpy = vi.spyOn(document, 'documentElement', 'get')
})

afterEach(() => {
Expand Down
7 changes: 4 additions & 3 deletions app/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, test, expect } from 'vitest'
import { classNames, getSlug, unixTimestampToMonthYear } from './utils'

test('classNames', () => {
Expand All @@ -13,17 +14,17 @@ test('unixTimestampToMonthYear', () => {
})

describe('getSlug', () => {
it('applies lowercase', () => {
test('applies lowercase', () => {
expect(getSlug('HelloWorld')).toEqual('helloworld')
})

it('replaces spaces with hyphens', () => {
test('replaces spaces with hyphens', () => {
expect(getSlug('hello world good morning')).toEqual(
'hello-world-good-morning',
)
})

it('removes non-alphanumeric characters, except hyphens', () => {
test('removes non-alphanumeric characters, except hyphens', () => {
expect(getSlug('Hello, World!-')).toEqual('hello-world-')
})
})
7 changes: 0 additions & 7 deletions jest.config.js

This file was deleted.

24 changes: 11 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"start": "next dev",
"tsc": "tsc --noEmit",
"test": "jest",
"test": "vitest run",
"lint": "eslint app/ tests/ --ext .ts --ext .tsx",
"prettier": "prettier --write app/ tests/",
"prebuild": "next telemetry disable",
Expand All @@ -19,33 +19,31 @@
"dependencies": {
"@headlessui/react": "^1.7.18",
"lodash.debounce": "^4.0.8",
"next": "^14.0.4",
"next": "^14.1.0",
"prismjs": "^1.29.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"sharp": "^0.33.2"
},
"devDependencies": {
"@googleapis/docs": "^3.0.0",
"@playwright/test": "^1.40.1",
"@swc/jest": "^0.2.29",
"@types/jest": "^29.5.11",
"@types/node": "^20.11.0",
"@playwright/test": "^1.41.1",
"@types/node": "^20.11.5",
"@types/prismjs": "^1.26.3",
"@types/react": "^18.2.47",
"autoprefixer": "^10.4.16",
"@types/react": "^18.2.48",
"autoprefixer": "^10.4.17",
"eslint": "^8.56.0",
"eslint-config-next": "^14.0.4",
"eslint-config-next": "^14.1.0",
"eslint-config-prettier": "^9.1.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^23.2.0",
"lint-staged": "^15.2.0",
"postcss": "^8.4.33",
"prettier": "^3.2.2",
"prettier": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.5.11",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"vitest": "^1.2.1"
},
"lint-staged": {
"*.{ts,tsx}": [
Expand Down
Loading

0 comments on commit 6ab506c

Please sign in to comment.