diff --git a/app/jest.config.js b/app/jest.config.js deleted file mode 100644 index 9cc18d9f67..0000000000 --- a/app/jest.config.js +++ /dev/null @@ -1,14 +0,0 @@ -/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ -const base = require('../jest.config.js'); - -require('dotenv').config(); - -module.exports = { - ...base, - preset: 'ts-jest', - testEnvironment: 'node', - moduleNameMapper: { - ...base.moduleNameMapper, - '@/(.*)': `${__dirname}/src/$1`, - }, -}; diff --git a/app/package.json b/app/package.json index 862bc8b517..4d293e4661 100644 --- a/app/package.json +++ b/app/package.json @@ -25,10 +25,10 @@ "dev": "vite", "build": "vite build", "serve": "vite preview", - "test": "jest", - "test:watch": "jest --watchAll" + "test": "vitest run", + "test:coverage": "vitest run --coverage", + "test:watch": "vitest" }, - "gitHead": "24621f3934dc77eb23441331040ed13c676ceffd", "devDependencies": { "@directus/docs": "9.14.2", "@directus/extensions-sdk": "^9.14.1", @@ -45,6 +45,7 @@ "@mapbox/mapbox-gl-draw": "1.3.0", "@mapbox/mapbox-gl-draw-static-mode": "1.0.1", "@mapbox/mapbox-gl-geocoder": "4.7.4", + "@pinia/testing": "^0.0.12", "@popperjs/core": "2.10.2", "@rollup/plugin-yaml": "3.1.0", "@sindresorhus/slugify": "2.1.0", @@ -59,7 +60,6 @@ "@types/dompurify": "2.3.1", "@types/file-saver": "^2.0.5", "@types/geojson": "7946.0.8", - "@types/jest": "28.1.4", "@types/json2csv": "^5.0.3", "@types/lodash": "4.14.177", "@types/mapbox__mapbox-gl-draw": "1.2.3", @@ -72,10 +72,12 @@ "@types/wellknown": "0.5.1", "@vitejs/plugin-vue": "2.3.3", "@vue/compiler-sfc": "3.2.36", + "@vue/test-utils": "^2.0.2", "apexcharts": "3.30.0", "axios": "0.24.0", "base-64": "1.0.0", "bytes": "^3.1.2", + "c8": "^7.12.0", "camelcase": "^7.0.0", "caret-pos": "2.0.0", "codemirror": "5.64.0", @@ -91,9 +93,9 @@ "flatpickr": "4.6.9", "front-matter": "4.0.2", "geojson": "^0.5.0", + "happy-dom": "^6.0.4", "highlight.js": "^11.5.1", "html-entities": "2.3.2", - "jest": "28.1.2", "joi": "^17.6.0", "json-to-graphql-query": "^2.2.4", "json2csv": "^5.0.7", @@ -120,11 +122,11 @@ "rollup": "^2.75.6", "sass": "1.43.4", "tinymce": "5.10.2", - "ts-jest": "28.0.5", "tslib": "^2.4.0", "typescript": "4.7.3", "vite": "2.9.9", "vite-plugin-vue-markdown": "0.1.1", + "vitest": "^0.18.1", "vue": "3.2.36", "vue-i18n": "9.1.10", "vue-router": "4.0.15", diff --git a/app/src/__utils__/crypto.ts b/app/src/__utils__/crypto.ts new file mode 100644 index 0000000000..71e547cc26 --- /dev/null +++ b/app/src/__utils__/crypto.ts @@ -0,0 +1,7 @@ +import crypto from 'node:crypto'; + +export const cryptoStub = { + value: { + getRandomValues: (arr: any[]) => crypto.randomBytes(arr.length), + }, +}; diff --git a/app/src/components/__snapshots__/v-sheet.test.ts.snap b/app/src/components/__snapshots__/v-sheet.test.ts.snap new file mode 100644 index 0000000000..138cb1f1d9 --- /dev/null +++ b/app/src/components/__snapshots__/v-sheet.test.ts.snap @@ -0,0 +1,3 @@ +// Vitest Snapshot v1 + +exports[`Mount component 1`] = `"
Slot Content
"`; diff --git a/app/src/components/v-sheet.test.ts b/app/src/components/v-sheet.test.ts new file mode 100644 index 0000000000..c9fe15a4e5 --- /dev/null +++ b/app/src/components/v-sheet.test.ts @@ -0,0 +1,16 @@ +import { test, expect } from 'vitest'; +import { mount } from '@vue/test-utils'; + +import VSheet from './v-sheet.vue'; + +test('Mount component', () => { + expect(VSheet).toBeTruthy(); + + const wrapper = mount(VSheet, { + slots: { + default: 'Slot Content', + }, + }); + + expect(wrapper.html()).toMatchSnapshot(); +}); diff --git a/app/src/components/v-sheet.vue b/app/src/components/v-sheet.vue index 5be539f32b..ef0db684eb 100644 --- a/app/src/components/v-sheet.vue +++ b/app/src/components/v-sheet.vue @@ -4,19 +4,8 @@ - - - -