denoland / denoland/std

[bug] `assertInlineSnapshot()` fails on write with `error: null`

Open
#6,746 4 comments 1 reaction 0 assignees View on GitHub
bug needs triage
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

`assertInlineSnapshot()` fails whenever an `--update` requires a write. This seems very similar to #5155.

**Steps to Reproduce**

```ts
// foo.test.ts
import { assertInlineSnapshot } from 'jsr:@std/testing@1.0.14/unstable-snapshot'

Deno.test('hello', () => {
assertInlineSnapshot(1, `2`) // force a write by changing the expected value.
})
```

```
$ deno test --allow-read=. --allow-write=. foo.test.ts -- --update
Check file:///home/user/desk/test/foo.test.ts
running 1 test from ./foo.test.ts
hello ... ok (0ms)
Uncaught error from ./foo.test.ts FAILED

ERRORS

./foo.test.ts (uncaught error)
error: null
This error was not caught from a test and caused the test runner to fail on the referenced module.
It most likely originated from a dangling promise, event/timeout handler or top-level code.

FAILURES

./foo.test.ts (uncaught error)

FAILED | 1 passed | 1 failed (6ms)

error: Test failed
```

**Expected behavior**

No error is thrown or if an error is thrown, it should be descriptive.

**Environment**

- OS: [e.g. Ubuntu 20.04, MacOS 11] Debian 13
- deno version: 2.3.7
- std version: @std/testing@1.0.14/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.