mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-21 08:12:38 +00:00
Update vitest
This commit is contained in:
parent
4e9a0f6cb5
commit
60625ec9a0
4 changed files with 26 additions and 20 deletions
|
@ -48,7 +48,7 @@
|
|||
"jsdom": "^20.0.0",
|
||||
"prettier": "^2.5.1",
|
||||
"typescript": "^4.7.4",
|
||||
"vitest": "^0.27.3",
|
||||
"vitest": "^0.28.6",
|
||||
"vue-tsc": "^0.38.1"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -11,8 +11,22 @@ import { ref } from "vue";
|
|||
|
||||
type FormulaFunctions = keyof GenericFormula & keyof typeof Formula & keyof typeof Decimal;
|
||||
|
||||
interface CustomMatchers<R = unknown> {
|
||||
compare_tolerance(expected: DecimalSource): R;
|
||||
}
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace Vi {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface Assertion extends CustomMatchers {}
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface AsymmetricMatchersContaining extends CustomMatchers {}
|
||||
}
|
||||
}
|
||||
|
||||
expect.extend({
|
||||
compare_tolerance(received, expected) {
|
||||
compare_tolerance(received: DecimalSource, expected: DecimalSource) {
|
||||
const { isNot } = this;
|
||||
let pass = false;
|
||||
if (!Decimal.isFinite(expected)) {
|
||||
|
@ -35,20 +49,6 @@ expect.extend({
|
|||
}
|
||||
});
|
||||
|
||||
interface CustomMatchers<R = unknown> {
|
||||
compare_tolerance(expected: DecimalSource): R;
|
||||
}
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace Vi {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface Assertion extends CustomMatchers {}
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
interface AsymmetricMatchersContaining extends CustomMatchers {}
|
||||
}
|
||||
}
|
||||
|
||||
const testValues = ["-1e400", 0, 0.25] as const;
|
||||
|
||||
const invertibleZeroParamFunctionNames = [
|
||||
|
|
|
@ -57,8 +57,5 @@ export default defineConfig({
|
|||
]
|
||||
}
|
||||
})
|
||||
],
|
||||
test: {
|
||||
environment: "jsdom"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
9
vitest.config.ts
Normal file
9
vitest.config.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { mergeConfig } from 'vite'
|
||||
import { defineConfig } from 'vitest/config'
|
||||
import viteConfig from './vite.config'
|
||||
|
||||
export default mergeConfig(viteConfig, defineConfig({
|
||||
test: {
|
||||
environment: "jsdom"
|
||||
}
|
||||
}))
|
Loading…
Reference in a new issue