prettier-plugin-astro
prettier-plugin-astro copied to clipboard
🐛 BUG: If a specific test fails in a unit test, an unexplained `TypeError` is raised in the next test
Describe the Bug
It is exactly as it says in the title. It is related to #410.
Dependency information
Steps to Reproduce
Try running this test:
import { format } from 'prettier';
import { describe, expect, test } from 'vitest';
const fixtures = [
{
name: 'HTML-style `prettier-ignore` comment for script tag',
input: `
<!-- prettier-ignore -->
<script>
if (condition1) {
foo
} else if (condition2) {
bar
}
else
{
baz
}
</script>
`,
output: `<!-- prettier-ignore -->
<script>
if (condition1) {
foo
} else if (condition2) {
bar
}
else
{
baz
}
</script>
`,
},
{
name: 'Test passing as expected',
input: `
---
if (foo)
{
bar();
}
---
`,
output: `---
if (foo) {
bar();
}
---
`,
},
];
describe('Issue reporting', () => {
for (const fixture of fixtures) {
test(fixture.name, async () => {
expect(
await format(fixture.input, {
plugins: ['prettier-plugin-astro'],
parser: 'astro',
}),
).toBe(fixture.output);
});
}
});
The current behavior
Both tests fail.
The expected behavior
If #410 is not fixed, only the first test should fail. If #410 is fixed, both should pass.