Skip to content

Commit b629102

Browse files
chore(vue): add testing on router link
1 parent 2280596 commit b629102

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

example-project/vue-app-broken/src/App.vue

+1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ import { MyComponent, MyButton } from 'component-library-vue'
77
kidsNames="John"
88
/>
99
<my-button fill="ups">Button</my-button>
10+
<my-button router-link="/">Button</my-button>
1011
</template>

example-project/vue-app-broken/tests/type.test.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
88

99
describe('type check', () => {
1010
it('should fail type check', async () => {
11-
const result = await new Promise((resolve, rejects) => {
11+
const result = await new Promise<string>((resolve, rejects) => {
1212
let stdout = ''
1313
const child = cp.exec(`npm run build.app`, {
1414
cwd: path.resolve(__dirname, '..'),
@@ -24,11 +24,12 @@ describe('type check', () => {
2424
})
2525
});
2626

27-
expect(result).toContain(
28-
`App.vue(7,5): error TS2322: Type 'string' is not assignable to type 'string[]'.`
29-
)
30-
expect(result).toContain(
31-
`App.vue(9,14): error TS2322: Type '"ups"' is not assignable to type '"clear" | "outline" | "solid" | "default" | undefined'.`
32-
)
27+
const typeErrors = result.split('\n').filter((line) => line.startsWith('src/App.vue'))
28+
expect(typeErrors).toMatchInlineSnapshot(`
29+
[
30+
"src/App.vue(7,5): error TS2322: Type 'string' is not assignable to type 'string[]'.",
31+
"src/App.vue(9,14): error TS2322: Type '"ups"' is not assignable to type '"clear" | "outline" | "solid" | "default" | undefined'.",
32+
]
33+
`)
3334
})
3435
})

0 commit comments

Comments
 (0)