Skip to content

Commit

Permalink
tests: remove typescript^4 with vue-tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed Jun 29, 2024
1 parent 91d0cc2 commit 613bd6b
Show file tree
Hide file tree
Showing 30 changed files with 154 additions and 423 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
exports[`backend-integration > serve > get initial error 1`] = `"[{"checkerId":"TypeScript","frame":" 4 |/n 5 | function App() {/n > 6 | const [count, setCount] = useState<string>(0)/n | ^/n 7 |/n 8 | return (/n 9 | <div className=/"App/">","id":"<PROJECT_ROOT>/playground-temp/backend-integration/src/App.tsx","level":1,"loc":{"column":46,"file":"<PROJECT_ROOT>/playground-temp/backend-integration/src/App.tsx","line":6},"message":"Argument of type 'number' is not assignable to parameter of type 'string | (() => string)'.","stack":""}]"`;

exports[`backend-integration > serve > get initial error 2`] = `
"
[
"
ERROR(TypeScript) Argument of type 'number' is not assignable to parameter of type 'string | (() => string)'.
FILE <PROJECT_ROOT>/playground-temp/backend-integration/src/App.tsx:6:46
Expand All @@ -15,5 +16,6 @@ exports[`backend-integration > serve > get initial error 2`] = `
8 | return (
9 | <div className="App">
[TypeScript] Found 1 error. Watching for file changes."
[TypeScript] Found 1 error. Watching for file changes.",
]
`;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
exports[`config-default > serve > get initial error 1`] = `"[{"checkerId":"ESLint","frame":" 1 | import { text } from './text'/n 2 |/n > 3 | var hello = 'Hello'/n | ^^^^^^^^^^^^^^^^^^^/n 4 |/n 5 | const rootDom = document.querySelector('#root')! as HTMLElement/n 6 | rootDom.innerHTML = hello + text","id":"<PROJECT_ROOT>/playground-temp/config-default/src/main.ts","level":1,"loc":{"column":1,"file":"<PROJECT_ROOT>/playground-temp/config-default/src/main.ts","line":3},"message":"Unexpected var, use let or const instead. (no-var)","stack":""},{"checkerId":"ESLint","frame":" 3 | var hello = 'Hello'/n 4 |/n > 5 | const rootDom = document.querySelector('#root')! as HTMLElement/n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/n 6 | rootDom.innerHTML = hello + text/n 7 |/n 8 | export {}","id":"<PROJECT_ROOT>/playground-temp/config-default/src/main.ts","level":0,"loc":{"column":17,"file":"<PROJECT_ROOT>/playground-temp/config-default/src/main.ts","line":5},"message":"Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)","stack":""}]"`;

exports[`config-default > serve > get initial error 2`] = `
" ERROR(ESLint) Unexpected var, use let or const instead. (no-var)
[
" ERROR(ESLint) Unexpected var, use let or const instead. (no-var)
FILE <PROJECT_ROOT>/playground-temp/config-default/src/main.ts:3:1
1 | import { text } from './text'
Expand All @@ -13,7 +14,8 @@ exports[`config-default > serve > get initial error 2`] = `
4 |
5 | const rootDom = document.querySelector('#root')! as HTMLElement
6 | rootDom.innerHTML = hello + text
WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)
",
" WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)
FILE <PROJECT_ROOT>/playground-temp/config-default/src/main.ts:5:17
3 | var hello = 'Hello'
Expand All @@ -23,5 +25,7 @@ exports[`config-default > serve > get initial error 2`] = `
6 | rootDom.innerHTML = hello + text
7 |
8 | export {}
[ESLint] Found 1 error and 1 warning"
",
"[ESLint] Found 1 error and 1 warning",
]
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

exports[`config-terminal-false > serve > should not log into terminal 1`] = `"[{"checkerId":"ESLint","frame":" 1 | import { text } from './text'/n 2 |/n > 3 | var hello = 'Hello'/n | ^^^^^^^^^^^^^^^^^^^/n 4 |/n 5 | const rootDom = document.querySelector('#root')! as HTMLElement/n 6 | rootDom.innerHTML = hello + text","id":"<PROJECT_ROOT>/playground-temp/config-terminal-false/src/main.ts","level":1,"loc":{"column":1,"file":"<PROJECT_ROOT>/playground-temp/config-terminal-false/src/main.ts","line":3},"message":"Unexpected var, use let or const instead. (no-var)","stack":""},{"checkerId":"ESLint","frame":" 3 | var hello = 'Hello'/n 4 |/n > 5 | const rootDom = document.querySelector('#root')! as HTMLElement/n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/n 6 | rootDom.innerHTML = hello + text/n 7 |/n 8 | export {}","id":"<PROJECT_ROOT>/playground-temp/config-terminal-false/src/main.ts","level":0,"loc":{"column":17,"file":"<PROJECT_ROOT>/playground-temp/config-terminal-false/src/main.ts","line":5},"message":"Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)","stack":""}]"`;

exports[`config-terminal-false > serve > should not log into terminal 2`] = `""`;
exports[`config-terminal-false > serve > should not log into terminal 2`] = `[]`;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
exports[`eslint-config-log-level > serve > should only emit warning logs 1`] = `"[{"checkerId":"ESLint","frame":" 3 | var hello = 'Hello'/n 4 |/n > 5 | const rootDom = document.querySelector('#root')!/n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/n 6 | rootDom.innerHTML = hello + text/n 7 |/n 8 | export {}","id":"<PROJECT_ROOT>/playground-temp/eslint-config-log-level/src/main.ts","level":0,"loc":{"column":17,"file":"<PROJECT_ROOT>/playground-temp/eslint-config-log-level/src/main.ts","line":5},"message":"Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)","stack":""}]"`;

exports[`eslint-config-log-level > serve > should only emit warning logs 2`] = `
" WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)
[
" WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)
FILE <PROJECT_ROOT>/playground-temp/eslint-config-log-level/src/main.ts:5:17
3 | var hello = 'Hello'
Expand All @@ -13,13 +14,16 @@ exports[`eslint-config-log-level > serve > should only emit warning logs 2`] = `
6 | rootDom.innerHTML = hello + text
7 |
8 | export {}
[ESLint] Found 0 error and 1 warning"
",
"[ESLint] Found 0 error and 1 warning",
]
`;
exports[`eslint-config-log-level > serve > should only emit warning logs 3`] = `"[{"checkerId":"ESLint","frame":" 3 | var hello = 'Hello'/n 4 |/n > 5 | const rootDom = document.querySelector('#root')!/n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/n 6 | rootDom.innerHTML = hello + text/n 7 |/n 8 | export {}","id":"<PROJECT_ROOT>/playground-temp/eslint-config-log-level/src/main.ts","level":0,"loc":{"column":17,"file":"<PROJECT_ROOT>/playground-temp/eslint-config-log-level/src/main.ts","line":5},"message":"Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)","stack":""},{"checkerId":"ESLint","frame":" 3 | var hello = 'Hello~'/n 4 |/n > 5 | const rootDom = document.querySelector('#root')!/n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/n 6 | rootDom.innerHTML = hello + text/n 7 |/n 8 | export {}","id":"<PROJECT_ROOT>/playground-temp/eslint-config-log-level/src/main.ts","level":0,"loc":{"column":17,"file":"<PROJECT_ROOT>/playground-temp/eslint-config-log-level/src/main.ts","line":5},"message":"Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)","stack":""}]"`;
exports[`eslint-config-log-level > serve > should only emit warning logs 4`] = `
" WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)
[
" WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)
FILE <PROJECT_ROOT>/playground-temp/eslint-config-log-level/src/main.ts:5:17
3 | var hello = 'Hello~'
Expand All @@ -29,5 +33,7 @@ exports[`eslint-config-log-level > serve > should only emit warning logs 4`] = `
6 | rootDom.innerHTML = hello + text
7 |
8 | export {}
[ESLint] Found 0 error and 1 warning"
",
"[ESLint] Found 0 error and 1 warning",
]
`;
90 changes: 36 additions & 54 deletions playground/eslint-default/__tests__/__snapshots__/test.spec.ts.snap

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions playground/eslint-default/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import checker from 'vite-plugin-checker'
export default defineConfig({
plugins: [
checker({
typescript: true,
eslint: {
lintCommand: 'eslint ./src --ext .ts',
// dev: { logLevel: ['warning'] },
},
}),
],
Expand Down
14 changes: 10 additions & 4 deletions playground/eslint-flat/__tests__/__snapshots__/test.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,31 @@
exports[`eslint > serve > get initial error and subsequent error 1`] = `"[{"checkerId":"ESLint","frame":" > 1 | const a = /"hello/"/n | ^/n > 2 |/n | ^","id":"<PROJECT_ROOT>/playground-temp/eslint-flat/src/index.js","level":1,"loc":{"column":18,"file":"<PROJECT_ROOT>/playground-temp/eslint-flat/src/index.js","line":1},"message":"Missing semicolon. (semi)","stack":""}]"`;

exports[`eslint > serve > get initial error and subsequent error 2`] = `
" ERROR(ESLint) Missing semicolon. (semi)
[
" ERROR(ESLint) Missing semicolon. (semi)
FILE <PROJECT_ROOT>/playground-temp/eslint-flat/src/index.js:1:18
> 1 | const a = "hello"
| ^
> 2 |
| ^
[ESLint] Found 1 error and 0 warning"
",
"[ESLint] Found 1 error and 0 warning",
]
`;
exports[`eslint > serve > get initial error and subsequent error 3`] = `"[{"checkerId":"ESLint","frame":" > 1 | const a = /"hello/"/n | ^/n > 2 |/n | ^","id":"<PROJECT_ROOT>/playground-temp/eslint-flat/src/index.js","level":1,"loc":{"column":18,"file":"<PROJECT_ROOT>/playground-temp/eslint-flat/src/index.js","line":1},"message":"Missing semicolon. (semi)","stack":""},{"checkerId":"ESLint","frame":" > 1 | const a = /"hello/"/n | ^/n > 2 |/n | ^","id":"<PROJECT_ROOT>/playground-temp/eslint-flat/src/index.js","level":1,"loc":{"column":18,"file":"<PROJECT_ROOT>/playground-temp/eslint-flat/src/index.js","line":1},"message":"Missing semicolon. (semi)","stack":""}]"`;
exports[`eslint > serve > get initial error and subsequent error 4`] = `
" ERROR(ESLint) Missing semicolon. (semi)
[
" ERROR(ESLint) Missing semicolon. (semi)
FILE <PROJECT_ROOT>/playground-temp/eslint-flat/src/index.js:1:18
> 1 | const a = "hello"
| ^
> 2 |
| ^
[ESLint] Found 1 error and 0 warning"
",
"[ESLint] Found 1 error and 0 warning",
]
`;
20 changes: 12 additions & 8 deletions playground/multiple-hmr/__tests__/__snapshots__/test.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@
exports[`multiple-hmr > serve > get initial error and subsequent error 1`] = `"[{"checkerId":"ESLint","frame":" > 1 | export var value: string = 1/n | ^^^^^^^^^^^^^^^^^^^^^/n 2 |","id":"<PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts","level":1,"loc":{"column":8,"file":"<PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts","line":1},"message":"Unexpected var, use let or const instead. (no-var)","stack":""},{"checkerId":"TypeScript","frame":" > 1 | export var value: string = 1/n | ^^^^^/n 2 |","id":"<PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts","level":1,"loc":{"column":12,"file":"<PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts","line":1},"message":"Type 'number' is not assignable to type 'string'.","stack":""}]"`;

exports[`multiple-hmr > serve > get initial error and subsequent error 2`] = `
" ERROR(ESLint) Unexpected var, use let or const instead. (no-var)
FILE <PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts:1:8
> 1 | export var value: string = 1
| ^^^^^^^^^^^^^^^^^^^^^
2 |
[ESLint] Found 1 error and 0 warning
[
"
ERROR(TypeScript) Type 'number' is not assignable to type 'string'.
FILE <PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts:1:12
> 1 | export var value: string = 1
| ^^^^^
2 |
[TypeScript] Found 1 error. Watching for file changes."
[TypeScript] Found 1 error. Watching for file changes.",
" ERROR(ESLint) Unexpected var, use let or const instead. (no-var)
FILE <PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts:1:8
> 1 | export var value: string = 1
| ^^^^^^^^^^^^^^^^^^^^^
2 |
",
"[ESLint] Found 1 error and 0 warning",
]
`;
exports[`multiple-hmr > serve > get initial error and subsequent error 3`] = `"[{"checkerId":"ESLint","frame":" > 1 | export var value: string = 2/n | ^^^^^^^^^^^^^^^^^^^^^/n 2 |","id":"<PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts","level":1,"loc":{"column":8,"file":"<PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts","line":1},"message":"Unexpected var, use let or const instead. (no-var)","stack":""},{"checkerId":"TypeScript","frame":" > 1 | export var value: string = 2/n | ^^^^^/n 2 |","id":"<PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts","level":1,"loc":{"column":12,"file":"<PROJECT_ROOT>/playground-temp/multiple-hmr/src/value.ts","line":1},"message":"Type 'number' is not assignable to type 'string'.","stack":""}]"`;
Expand Down
5 changes: 3 additions & 2 deletions playground/multiple-hmr/__tests__/test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
isServe,
resetDiagnostics,
resetReceivedLog,
log,
sleepForEdit,
sleepForServerReady,
stripedLog,
Expand All @@ -20,7 +21,7 @@ describe('multiple-hmr', () => {
it('get initial error and subsequent error', async () => {
await sleepForServerReady()
expect(stringify(stable(diagnostics))).toMatchSnapshot()
expect(stripedLog).toMatchSnapshot()
expect(stable(stripedLog)).toMatchSnapshot()

console.log('-- edit with error --')
resetDiagnostics()
Expand Down Expand Up @@ -60,7 +61,7 @@ describe('multiple-hmr', () => {
]

it('should fail', async () => {
expectStderrContains(stripedLog, expectedMsg)
expectStderrContains(log, expectedMsg)
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@
exports[`multiple-reload > serve > get initial error and subsequent error 1`] = `"[{"checkerId":"ESLint","frame":" 1 | import { text } from './text'/n 2 |/n > 3 | var count: string = 0/n | ^^^^^^^^^^^^^^^^^^^^^/n 4 | const hello = 'Hello'/n 5 |/n 6 | const rootDom = document.querySelector('#root')!","id":"<PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts","level":1,"loc":{"column":1,"file":"<PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts","line":3},"message":"Unexpected var, use let or const instead. (no-var)","stack":""},{"checkerId":"ESLint","frame":" 4 | const hello = 'Hello'/n 5 |/n > 6 | const rootDom = document.querySelector('#root')!/n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/n 7 | rootDom.innerHTML = hello + text + count/n 8 |/n 9 | export {}","id":"<PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts","level":0,"loc":{"column":17,"file":"<PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts","line":6},"message":"Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)","stack":""},{"checkerId":"TypeScript","frame":" 1 | import { text } from './text'/n 2 |/n > 3 | var count: string = 0/n | ^^^^^/n 4 | const hello = 'Hello'/n 5 |/n 6 | const rootDom = document.querySelector('#root')!","id":"<PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts","level":1,"loc":{"column":5,"file":"<PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts","line":3},"message":"Type 'number' is not assignable to type 'string'.","stack":""}]"`;

exports[`multiple-reload > serve > get initial error and subsequent error 2`] = `
" ERROR(ESLint) Unexpected var, use let or const instead. (no-var)
[
"
ERROR(TypeScript) Type 'number' is not assignable to type 'string'.
FILE <PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts:3:5
1 | import { text } from './text'
2 |
> 3 | var count: string = 0
| ^^^^^
4 | const hello = 'Hello'
5 |
6 | const rootDom = document.querySelector('#root')!
[TypeScript] Found 1 error. Watching for file changes.",
" ERROR(ESLint) Unexpected var, use let or const instead. (no-var)
FILE <PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts:3:1
1 | import { text } from './text'
Expand All @@ -13,7 +27,8 @@ exports[`multiple-reload > serve > get initial error and subsequent error 2`] =
4 | const hello = 'Hello'
5 |
6 | const rootDom = document.querySelector('#root')!
WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)
",
" WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)
FILE <PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts:6:17
4 | const hello = 'Hello'
Expand All @@ -23,19 +38,9 @@ exports[`multiple-reload > serve > get initial error and subsequent error 2`] =
7 | rootDom.innerHTML = hello + text + count
8 |
9 | export {}
[ESLint] Found 1 error and 1 warning
ERROR(TypeScript) Type 'number' is not assignable to type 'string'.
FILE <PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts:3:5
1 | import { text } from './text'
2 |
> 3 | var count: string = 0
| ^^^^^
4 | const hello = 'Hello'
5 |
6 | const rootDom = document.querySelector('#root')!
[TypeScript] Found 1 error. Watching for file changes."
",
"[ESLint] Found 1 error and 1 warning",
]
`;
exports[`multiple-reload > serve > get initial error and subsequent error 3`] = `"[{"checkerId":"ESLint","frame":" 1 | import { text } from './text'/n 2 |/n > 3 | var count: string = 0/n | ^^^^^^^^^^^^^^^^^^^^^/n 4 | const hello = 'Hello'/n 5 |/n 6 | const rootDom = document.querySelector('#root')!","id":"<PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts","level":1,"loc":{"column":1,"file":"<PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts","line":3},"message":"Unexpected var, use let or const instead. (no-var)","stack":""},{"checkerId":"ESLint","frame":" 4 | const hello = 'Hello'/n 5 |/n > 6 | const rootDom = document.querySelector('#root')!/n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/n 7 | rootDom.innerHTML = hello + text + count/n 8 |/n 9 | export {}","id":"<PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts","level":0,"loc":{"column":17,"file":"<PROJECT_ROOT>/playground-temp/multiple-reload/src/main.ts","line":6},"message":"Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion)","stack":""}]"`;
Expand Down
7 changes: 4 additions & 3 deletions playground/multiple-reload/__tests__/test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
isServe,
resetDiagnostics,
resetReceivedLog,
log,
sleepForEdit,
sleepForServerReady,
stripedLog,
Expand All @@ -20,7 +21,7 @@ describe('multiple-reload', () => {
it('get initial error and subsequent error', async () => {
await sleepForServerReady()
expect(stringify(stable(diagnostics))).toMatchSnapshot()
expect(stripedLog).toMatchSnapshot()
expect(stable(stripedLog)).toMatchSnapshot()

console.log('-- edit with error --')
resetDiagnostics()
Expand All @@ -33,7 +34,7 @@ describe('multiple-reload', () => {
// don't know why striped log in disorder on Linux, while correct on mac and Windows
// comment out for now to pass test cases stably and striped log is duplicated with diagnostics somehow.
// Need help to figure out what went wrong. 😅
// expect(stripedLog).toMatchSnapshot()
// expect(stable(stripedLog)).toMatchSnapshot()

console.log('-- fix typescript error --')
resetDiagnostics()
Expand All @@ -60,7 +61,7 @@ describe('multiple-reload', () => {
]

it('should fail', async () => {
expectStderrContains(stripedLog, expectedMsg)
expectStderrContains(log, expectedMsg)
})
})
})
Loading

0 comments on commit 613bd6b

Please sign in to comment.