Skip to content

Commit

Permalink
test: fix test for hermes
Browse files Browse the repository at this point in the history
  • Loading branch information
sparten11740 committed Feb 17, 2025
1 parent e9ae4cd commit ef804ce
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/jest/snapshot.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { createRequire } from 'node:module'

it('simple', () => {
expect(10).toMatchSnapshot()
expect(null).toMatchSnapshot()
Expand Down Expand Up @@ -251,11 +249,19 @@ test('inline snapshots, prefixed', () => {
`) // end padding is ignored!
})

it('supports named snapshots', () => {
it('supports named snapshots', async () => {
expect({ name: 'Bruce Wayne' }).toMatchSnapshot('public knowledge')
expect({ identity: 'Batman', name: 'Bruce Wayne' }).toMatchSnapshot('not so public knowledge')
expect({ name: 'Joker', address: 'Arkham Asylum' }).toMatchSnapshot('public knowledge')

let createRequire
try {
;({ createRequire } = await import('node:module'))
} catch {
// skip the rest of this test for environments without node:module
return
}

const require = createRequire(import.meta.url)
const snapshots = require('./__snapshots__/snapshot.test.js.snap')

Expand Down

0 comments on commit ef804ce

Please sign in to comment.