Skip to content

Cannot find '$env/dynamic/public' when running bun test. #15381

@cybercoder-naj

Description

@cybercoder-naj

Describe the bug

I am using bun test for running my tests. But get this error everytime:

# Unhandled error between tests
-------------------------------
error: Cannot find module '$env/dynamic/public' from 'path/to/file'
-------------------------------

Edit: No issue when replacing bun:test with vitest. So i believe #8365 solved the issue partially with vitest only.

Reproduction

https://github.com/cybercoder-naj/svelte-test-env-repo

Logs

System Info

System:
    OS: Linux 6.12 EndeavourOS
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 5.95 GB / 15.29 GB
    Container: Yes
    Shell: 3.7.1 - /bin/fish
  Binaries:
    Node: 20.18.2 - /usr/bin/node
    npm: 11.1.0 - /usr/bin/npm
    pnpm: 10.4.0 - /usr/bin/pnpm
    bun: 1.2.2 - ~/.bun/bin/bun
  npmPackages:
    svelte: ^5.0.0 => 5.20.4

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions