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

🐛 BUG: If a specific test fails in a unit test, an unexplained TypeError is raised in the next test #411

Open
ony3000 opened this issue Feb 26, 2024 · 0 comments

Comments

@ony3000
Copy link

ony3000 commented Feb 26, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant