Skip to content

Commit

Permalink
swap jest for vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeragamba committed Aug 13, 2024
1 parent 9aa44d3 commit 0672702
Show file tree
Hide file tree
Showing 7 changed files with 408 additions and 4,950 deletions.
11 changes: 0 additions & 11 deletions .idea/runConfigurations/Test_Client.xml

This file was deleted.

44 changes: 9 additions & 35 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"tsc": "tsc -b",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
Expand All @@ -26,61 +27,27 @@
"@reduxjs/toolkit": "^2.2.2",
"@tanstack/react-query": "^5.28.9",
"@tanstack/react-query-devtools": "^5.28.10",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.7",
"@types/react": "^18.2.73",
"@types/react-dom": "^18.0.11",
"@types/uuid": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"add": "^2.0.6",
"axios": "^1.3.4",
"bfj": "^8.0.0",
"browserslist": "^4.18.1",
"camelcase": "^8.0.0",
"classnames": "^2.3.1",
"css-loader": "^6.5.1",
"date-fns": "^2.29.3",
"dotenv": "^16.3.1",
"dotenv-cli": "^7.0.0",
"dotenv-expand": "^11.0.6",
"eslint": "^8.3.0",
"eslint-plugin-react": "^7.28",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"fast-sort": "^3.4.1",
"file-loader": "^6.2.0",
"fs-extra": "^11.1.1",
"globals": "^15.9.0",
"history": "^5.3.0",
"identity-obj-proxy": "^3.0.0",
"image-loader": "^0.0.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-mock-extended": "^3.0.5",
"jest-resolve": "^29.7.0",
"jest-watch-typeahead": "^2.2.2",
"markdown-to-jsx": "^7.4.5",
"mini-css-extract-plugin": "^2.4.5",
"mui-markdown": "^1.1.13",
"react": "^18.1.0",
"react-app-polyfill": "^3.0.0",
"react-dev-utils": "^12.0.1",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.1.0",
"react-hook-form": "^7.51.2",
"react-refresh": "^0.14.0",
"react-router-dom": "^6.8.2",
"resolve": "^1.20.0",
"resolve-url-loader": "^5.0.0",
"sass-embedded": "^1.77.8",
"sass-loader": "^14.1.1",
"semver": "^7.3.5",
"source-map-loader": "^5.0.0",
"style-loader": "^3.3.1",
"typescript": "^5.2.2",
"typescript-eslint": "^8.0.0",
"uuid": "^10.0.0",
Expand All @@ -89,5 +56,12 @@
"web-vitals": "^3.1.0",
"zod": "^3.22.4"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"workspaces": [
"packages/*"
],
"devDependencies": {
"@types/node": "^22.2.0",
"vitest": "^2.0.5"
}
}
14 changes: 7 additions & 7 deletions packages/client/src/Images/ImageManager/ChangesReducer.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mock } from 'jest-mock-extended'
import crypto from 'node:crypto'
import { beforeEach, describe, expect, it } from 'vitest'

import {
addImage,
Expand All @@ -12,8 +12,8 @@ import {
SetImagesPayload,
} from './Actions'
import { changesReducer } from './ChangesReducer'
import { freeze } from '../../Lib/TestHelpers'
import { ImageData } from '../../Models/ImageData'
import { freeze } from '../../Lib'
import { ImageData } from '../../Models'
import {
AddImageChangeRecord,
EditImageChangeRecord,
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('ChangesReducer', () => {
imageId = crypto.randomUUID()
payload = {
id: imageId,
file: mock<File>(),
file: {} as File,
position: 0,
filename: 'exampleImage',
}
Expand All @@ -73,7 +73,7 @@ describe('ChangesReducer', () => {
id: imageId,
filename: 'original',
position: 0,
file: mock<File>(),
file: {} as File,
}))
})

Expand Down Expand Up @@ -170,7 +170,7 @@ describe('ChangesReducer', () => {
id: imageId,
filename: 'original',
position: 0,
file: mock<File>(),
file: {} as File,
}))
})

Expand Down Expand Up @@ -245,7 +245,7 @@ describe('ChangesReducer', () => {
id: imageId,
filename: 'original',
position: 0,
file: mock<File>(),
file: {} as File,
}))
})

Expand Down
12 changes: 6 additions & 6 deletions packages/client/src/Images/ImageManager/ImagesReducer.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { mock } from 'jest-mock-extended'
import crypto from 'node:crypto'
import { beforeEach, describe, expect, it, vi } from 'vitest'

import { addImage, AddImagePayload, editImage, EditImagePayload, setImages, SetImagesPayload } from './Actions'
import { imagesReducer } from './ImagesReducer'
import { freeze } from '../../Lib/TestHelpers'
import { ImageData } from '../../Models/ImageData'
import { freeze } from '../../Lib'
import { ImageData } from '../../Models'

describe('ImageReducer', () => {
let oldState: ImageData[]

beforeEach(async () => {
global.URL.createObjectURL = jest.fn()
global.URL.createObjectURL = vi.fn()

oldState = freeze([
{
Expand Down Expand Up @@ -58,7 +58,7 @@ describe('ImageReducer', () => {
payload = {
id: crypto.randomUUID(),
position: 0,
file: mock<File>(),
file: {} as File,
filename: 'exampleImage',
}
})
Expand Down Expand Up @@ -113,7 +113,7 @@ describe('ImageReducer', () => {
const newState = imagesReducer(oldState, addImage({
id: imageId,
position: 0,
file: mock<File>(),
file: {} as File,
filename: 'exampleImage',
}))

Expand Down
5 changes: 0 additions & 5 deletions packages/client/src/setupTests.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ if (process.env.HTTPS === 'true') {

// https://vitejs.dev/config/
export default defineConfig({
envDir: '../..',
plugins: [
react(),
checker({
Expand Down
Loading

0 comments on commit 0672702

Please sign in to comment.