mirror of
https://github.com/UniversityOfHelsinkiCS/oodikone.git
synced 2026-10-12 19:03:39 +03:00
[Frontend][UnitTests] Migrate frontend unit tests to vitest
This commit is contained in:
Generated
+378
-509
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
|||||||
"build": "tsc --noEmit && NODE_OPTIONS=\"--max-old-space-size=4096\" vite build",
|
"build": "tsc --noEmit && NODE_OPTIONS=\"--max-old-space-size=4096\" vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"tsc": "tsc",
|
"tsc": "tsc",
|
||||||
"test:unit": "node --import tsx --test './tests/unit/**/*test.ts' --test-reporter spec --test-force-exit",
|
"test:unit": "vitest ./tests/unit",
|
||||||
"test:component": "playwright test -c playwright-ct.config.ts"
|
"test:component": "playwright test -c playwright-ct.config.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -48,8 +48,8 @@
|
|||||||
"@types/react-dom": "^18.3.7",
|
"@types/react-dom": "^18.3.7",
|
||||||
"@vitejs/plugin-react": "^6.0.3",
|
"@vitejs/plugin-react": "^6.0.3",
|
||||||
"babel-plugin-react-compiler": "1.0.0",
|
"babel-plugin-react-compiler": "1.0.0",
|
||||||
"tsx": "4.22.4",
|
|
||||||
"typescript": "^7.0.2",
|
"typescript": "^7.0.2",
|
||||||
"vite": "^8.1.4"
|
"vite": "^8.1.4",
|
||||||
|
"vitest": "4.1.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -1,5 +1,4 @@
|
|||||||
import assert from 'node:assert/strict'
|
import { describe, it, assert } from 'vitest'
|
||||||
import { describe, it } from 'node:test'
|
|
||||||
|
|
||||||
import { makeTableStats } from '@/util/creditsProduced'
|
import { makeTableStats } from '@/util/creditsProduced'
|
||||||
|
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
import assert from 'node:assert/strict'
|
|
||||||
import { describe, it } from 'node:test'
|
|
||||||
|
|
||||||
import { getProgressCriteria } from '@/redux/populations/criteriaProgress'
|
import { getProgressCriteria } from '@/redux/populations/criteriaProgress'
|
||||||
import { CreditTypeCode, ProgressCriteria } from '@oodikone/shared/types'
|
import { CreditTypeCode, ProgressCriteria } from '@oodikone/shared/types'
|
||||||
import { StudentStudyPlan } from '@oodikone/shared/types/studentData'
|
import { StudentStudyPlan } from '@oodikone/shared/types/studentData'
|
||||||
|
|
||||||
import { PopulationCourseStatsCredit } from '@/redux/populations/util'
|
import { PopulationCourseStatsCredit } from '@/redux/populations/util'
|
||||||
|
import { describe, it, assert } from 'vitest'
|
||||||
|
|
||||||
const createCriteria = (overrides: Partial<ProgressCriteria> = {}): ProgressCriteria => ({
|
const createCriteria = (overrides: Partial<ProgressCriteria> = {}): ProgressCriteria => ({
|
||||||
allCourseGroups: {
|
allCourseGroups: {
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import path from 'path'
|
||||||
|
import { defineConfig } from 'vitest/config'
|
||||||
|
|
||||||
|
// oxlint-disable-next-line no-default-export
|
||||||
|
export default defineConfig({
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': path.resolve(__dirname, './src'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
reporters: ['tree'],
|
||||||
|
exclude: ['./dist', 'node_modules'],
|
||||||
|
pool: 'threads',
|
||||||
|
testTimeout: 10_000, // 10s timeout
|
||||||
|
sequence: {
|
||||||
|
concurrent: true, // Enable parallel tests by default
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user