Switch from jest to vitest

Note: this is a very actively developed library,
and I created an issue for an issue I was having with VSC integration:
https://github.com/vitest-dev/vscode/issues/52
This commit is contained in:
thepaperpilot 2022-07-07 20:30:19 -05:00
parent 11516dd0cf
commit ff183e02ff
7 changed files with 528 additions and 11642 deletions

23
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,23 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Debug Current Test File",
"autoAttachChildProcesses": true,
"skipFiles": [
"<node_internals>/**",
"**/node_modules/**"
],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": [
"run",
"${relativeFile}"
],
"smartStep": true,
"console": "integratedTerminal"
}
]
}

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"vitest.commandLine": "npx vitest"
}

View file

@ -1,7 +0,0 @@
module.exports = {
preset: "vite-jest",
testEnvironment: "jest-environment-jsdom",
moduleNameMapper: {
"^./../([^.].*)$": "$1"
}
};

12118
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,8 @@
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
"test": "vite-jest --no-cache"
"test": "vitest run",
"testw": "vitest"
},
"dependencies": {
"@pixi/particle-emitter": "^5.0.4",
@ -32,18 +33,15 @@
"devDependencies": {
"@ivanv/vue-collapse-transition": "^1.0.2",
"@rushstack/eslint-patch": "^1.1.0",
"@types/jest": "^28.1.3",
"@types/lodash.clonedeep": "^4.5.6",
"@types/lz-string": "^1.3.34",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^10.0.0",
"babel-jest": "^28.1.1",
"eslint": "^8.6.0",
"jest": "^27.5.1",
"jest-environment-jsdom": "^27.5.1",
"jsdom": "^20.0.0",
"prettier": "^2.5.1",
"typescript": "~4.5.5",
"vite-jest": "^0.1.4",
"vitest": "^0.17.1",
"vue-tsc": "^0.38.1"
},
"browserslist": [

View file

@ -1,5 +1,5 @@
import { jest, describe, expect, test } from "@jest/globals";
import { camelToTitle, isFunction } from "util/common";
import { describe, expect, test, vi } from "vitest";
describe("camelToTitle", () => {
test("Capitalizes first letter in single word", () =>
@ -10,7 +10,7 @@ describe("camelToTitle", () => {
});
describe("isFunction", () => {
test("Given function returns true", () => expect(isFunction(jest.fn())).toBe(true));
test("Given function returns true", () => expect(isFunction(vi.fn())).toBe(true));
// Go through all primitives and basic types
test("Given a string returns false", () => expect(isFunction("test")).toBe(false));

View file

@ -40,5 +40,8 @@ export default defineConfig({
]
}
})
]
],
test: {
environment: "jsdom"
}
});