Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-expect-error is not failing tests when it should #4207

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/tsc/tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
for (const file of files) {
const filePath = path.join(dir, file);
const stat = fs.statSync(filePath);
if (stat.isDirectory()) {
if (stat.isDirectory() && file !== 'should-error') {
const tsconfigPath = path.join(filePath, 'tsconfig.json');
if (fs.existsSync(tsconfigPath)) {
tests.push([
Expand Down Expand Up @@ -77,4 +77,13 @@
for (const [path, isRoot] of tests) {
it(`vue-tsc no errors (${prettyPath(path, isRoot)})`, () => runVueTsc(path), 400_000);
}

it(`should throw an error when no vue-expect-error is used but the there is no error`, async () => {
try {
await runVueTsc(path.resolve(workspace, 'should-error'));
} catch (e) {
return;
}
throw new Error('Expected an error but got none');

Check failure on line 87 in packages/tsc/tests/index.spec.ts

View workflow job for this annotation

GitHub Actions / build (16, ubuntu-latest)

packages/tsc/tests/index.spec.ts > vue-tsc > should throw an error when no vue-expect-error is used but the there is no error

Error: Expected an error but got none ❯ packages/tsc/tests/index.spec.ts:87:9
});
});
8 changes: 8 additions & 0 deletions test-workspace/tsc/should-error/main.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script setup lang="ts">
const foo = {};
</script>

<template>
<!-- @vue-expect-error -->
<div v-bind="foo"></div>
</template>
4 changes: 4 additions & 0 deletions test-workspace/tsc/should-error/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": [ "**/*" ]
}