Skip to content

🐛 BUG: Vitest inline snapshot does not get updated #7288

@NonSpicyBurrito

Description

@NonSpicyBurrito

Which Cloudflare product(s) does this pertain to?

Workers Vitest Integration

What version(s) of the tool(s) are you using?

3.60.3 [Wrangler]

What version of Node are you using?

20.18.0

What operating system and version are you using?

Windows 10

Describe the Bug

Observed behavior

Inline snapshot does not get updated.

Expected behavior

Inline snapshot gets updated.

Steps to reproduce

  • npm create cloudflare@latest, select hello world example with TS.
  • Delete some code in test/index.spect.ts so that it's left with:
import { SELF } from 'cloudflare:test';
import { it, expect } from 'vitest';

it('responds with Hello World! (integration style)', async () => {
    const response = await SELF.fetch('https://example.com');
    expect(await response.text()).toMatchInlineSnapshot();
});
  • npm run test, observe that inline snapshot does not get updated.
  • Add two lines of useless comments such as:
import { SELF } from 'cloudflare:test';
import { it, expect } from 'vitest';

+ // hello
+ // world
it('responds with Hello World! (integration style)', async () => {
    const response = await SELF.fetch('https://example.com');
    expect(await response.text()).toMatchInlineSnapshot();
});
  • npm run test, observe that inline snapshot does get updated.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't workingvitestRelating to the Workers Vitest integration

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions