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

Bun crashes when type is missing in import using bun:test #16110

Open
Erwin-Goossen opened this issue Jan 2, 2025 · 2 comments
Open

Bun crashes when type is missing in import using bun:test #16110

Erwin-Goossen opened this issue Jan 2, 2025 · 2 comments
Labels
crash An issue that could cause a crash macOS An issue that occurs on macOS runtime

Comments

@Erwin-Goossen
Copy link

Erwin-Goossen commented Jan 2, 2025

How can we reproduce the crash?

What version of Bun is running?

1.1.38

What platform is your computer?

macOS 14.6.1 (23G93)

What steps can reproduce the bug?

Run this minimal test

import { Mock } from 'bun:test';

describe('Login X', () => {
  it('should render an accessible Login component with text', async () => {
    expect(true).toBe(true);
  });

Running this test will result in the next output in the console:

bun test v1.1.38 (bf2f153f)

src/components/LoginButton/LoginX.spec.tsx:
============================================================
Bun v1.1.38 (bf2f153f) macOS Silicon
macOS v14.6.1
Args: "bun" "test" "/<PATH_TO_PROJECT>/src/components/LoginButton/LoginX.spec.tsx" "-t" "Login X"
Features: bunfig jsc transpiler_cache(11) tsconfig(3) 
Builtins: "node:buffer" "node:child_process" "node:crypto" "node:fs" "node:http" "node:https" "node:net" "node:os" "node:perf_hooks" "node:stream" "node:stream/web" "node:string_decoder" "node:tty" "node:url" "node:util" "node:util/types" "node:vm" "node:zlib" 
Elapsed: 240ms | User: 312ms | Sys: 77ms
RSS: 0.16GB | Peak: 0.16GB | Commit: 0.90GB | Faults: 54

panic(main thread): Segmentation fault at address 0xBD
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

While running it like this, with type in front of Mock:

import { type Mock } from 'bun:test';

describe('Login X', () => {
  it('should render an accessible Login component with text', async () => {
    expect(true).toBe(true);
  });

it succeeds with success

Expected behaviour

When an import does not work (for whatever reason), return a proper message and do not crach

Relevant log output

Stack Trace (bun.report)

Bun v1.1.38 (bf2f153) on macos aarch64 [TestCommand]

Segmentation fault at address 0x000000BD

  • 3 unknown/js code
  • llint_entry
  • vmEntryToJavaScript
  • JSC::Interpreter::executeModuleProgram
  • JSC::JSModuleRecord::evaluate
  • JSC::JSModuleLoader::evaluate

Features: bunfig, jsc, transpiler_cache, tsconfig

Sentry Issue: BUN-3NN

@Erwin-Goossen Erwin-Goossen added the crash An issue that could cause a crash label Jan 2, 2025
Copy link
Contributor

github-actions bot commented Jan 2, 2025

@Erwin-Goossen, the latest version of Bun is v1.1.41, but this crash was reported on Bun v1.1.38.

Are you able to reproduce this crash on the latest version of Bun?

bun upgrade

@github-actions github-actions bot added macOS An issue that occurs on macOS runtime labels Jan 2, 2025
@Erwin-Goossen
Copy link
Author

Also crashing with v1.1.42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash An issue that could cause a crash macOS An issue that occurs on macOS runtime
Projects
None yet
Development

No branches or pull requests

1 participant