forked from profectus/Profectus
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:
parent
11516dd0cf
commit
ff183e02ff
7 changed files with 528 additions and 11642 deletions
23
.vscode/launch.json
vendored
Normal file
23
.vscode/launch.json
vendored
Normal 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
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"vitest.commandLine": "npx vitest"
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
preset: "vite-jest",
|
|
||||||
testEnvironment: "jest-environment-jsdom",
|
|
||||||
moduleNameMapper: {
|
|
||||||
"^./../([^.].*)$": "$1"
|
|
||||||
}
|
|
||||||
};
|
|
12118
package-lock.json
generated
12118
package-lock.json
generated
File diff suppressed because it is too large
Load diff
10
package.json
10
package.json
|
@ -7,7 +7,8 @@
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test": "vite-jest --no-cache"
|
"test": "vitest run",
|
||||||
|
"testw": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pixi/particle-emitter": "^5.0.4",
|
"@pixi/particle-emitter": "^5.0.4",
|
||||||
|
@ -32,18 +33,15 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ivanv/vue-collapse-transition": "^1.0.2",
|
"@ivanv/vue-collapse-transition": "^1.0.2",
|
||||||
"@rushstack/eslint-patch": "^1.1.0",
|
"@rushstack/eslint-patch": "^1.1.0",
|
||||||
"@types/jest": "^28.1.3",
|
|
||||||
"@types/lodash.clonedeep": "^4.5.6",
|
"@types/lodash.clonedeep": "^4.5.6",
|
||||||
"@types/lz-string": "^1.3.34",
|
"@types/lz-string": "^1.3.34",
|
||||||
"@vue/eslint-config-prettier": "^7.0.0",
|
"@vue/eslint-config-prettier": "^7.0.0",
|
||||||
"@vue/eslint-config-typescript": "^10.0.0",
|
"@vue/eslint-config-typescript": "^10.0.0",
|
||||||
"babel-jest": "^28.1.1",
|
|
||||||
"eslint": "^8.6.0",
|
"eslint": "^8.6.0",
|
||||||
"jest": "^27.5.1",
|
"jsdom": "^20.0.0",
|
||||||
"jest-environment-jsdom": "^27.5.1",
|
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"typescript": "~4.5.5",
|
"typescript": "~4.5.5",
|
||||||
"vite-jest": "^0.1.4",
|
"vitest": "^0.17.1",
|
||||||
"vue-tsc": "^0.38.1"
|
"vue-tsc": "^0.38.1"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { jest, describe, expect, test } from "@jest/globals";
|
|
||||||
import { camelToTitle, isFunction } from "util/common";
|
import { camelToTitle, isFunction } from "util/common";
|
||||||
|
import { describe, expect, test, vi } from "vitest";
|
||||||
|
|
||||||
describe("camelToTitle", () => {
|
describe("camelToTitle", () => {
|
||||||
test("Capitalizes first letter in single word", () =>
|
test("Capitalizes first letter in single word", () =>
|
||||||
|
@ -10,7 +10,7 @@ describe("camelToTitle", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("isFunction", () => {
|
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
|
// Go through all primitives and basic types
|
||||||
test("Given a string returns false", () => expect(isFunction("test")).toBe(false));
|
test("Given a string returns false", () => expect(isFunction("test")).toBe(false));
|
||||||
|
|
|
@ -40,5 +40,8 @@ export default defineConfig({
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
],
|
||||||
|
test: {
|
||||||
|
environment: "jsdom"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue