Skip to content

NuxtTime: Flaky testcase #32557

@jcppman

Description

@jcppman

Environment

nuxt@4.0.0-rc.0

Reproduction

run pnpm test locally in an easter timezone (in my case +8).

Describe the bug

the test case match rendered result with snapshot

    expect(thing.html()).toMatchInlineSnapshot(
      `"<time datetime="2023-02-11T18:26:41.058Z">11 February at 41</time>"`,
    )

because the timezone wasn't defined it will use system timezone, which makes the test case flaky and fail on some machines.

Additional context

No response

Logs

FAIL   nuxt-legacy  test/nuxt/nuxt-time.test.ts > <NuxtTime> > should not serialise data in the DOM in the client
Error: Snapshot `<NuxtTime> > should not serialise data in the DOM in the client 1` mismatched

Expected: ""<time datetime="2023-02-11T18:26:41.058Z">11 February at 41</time>""
Received: ""<time datetime="2023-02-11T18:26:41.058Z">12 February at 41</time>""

 ❯ test/nuxt/nuxt-time.test.ts:21:26
     19|       }),
     20|     )
     21|     expect(thing.html()).toMatchInlineSnapshot(
       |                          ^
     22|       `"<time datetime="2023-02-11T18:26:41.058Z">11 February at 41</time>"`,
     23|     )

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions