Skip to content

Commit 4fc04dc

Browse files
committed
test: add snap test for vitest globals with type-aware linting
Ensures `vp check` passes when using vitest globals (`test.globals: true`) with type-aware linting and `typescript/no-unsafe-call` rule enabled.
1 parent 717f2a0 commit 4fc04dc

7 files changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "check-vitest-globals-typecheck",
3+
"version": "0.0.0",
4+
"private": true
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> vp check
2+
pass: All 6 files are correctly formatted (<variable>ms, <variable> threads)
3+
pass: Found no warnings, lint errors, or type errors in 3 files (<variable>ms, <variable> threads)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { fn } from "./index.ts";
2+
3+
test("fn", () => {
4+
expect(fn()).toBe("Hello, world!");
5+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function fn() {
2+
return "Hello, world!";
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"env": {
3+
"VITE_DISABLE_AUTO_INSTALL": "1"
4+
},
5+
"commands": ["vp check"]
6+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"target": "esnext",
4+
"module": "nodenext",
5+
"moduleResolution": "nodenext",
6+
"types": ["vite-plus/test/globals"],
7+
"strict": true,
8+
"noEmit": true,
9+
"allowImportingTsExtensions": true,
10+
"skipLibCheck": true
11+
},
12+
"include": ["src"]
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default {
2+
test: {
3+
globals: true,
4+
},
5+
lint: {
6+
options: {
7+
typeAware: true,
8+
typeCheck: true,
9+
},
10+
rules: {
11+
"typescript/no-unsafe-call": "error",
12+
},
13+
},
14+
};

0 commit comments

Comments
 (0)