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

Importing from $app/forms fails in tests #11151

Closed
Gil3co opened this issue Nov 30, 2023 · 2 comments
Closed

Importing from $app/forms fails in tests #11151

Gil3co opened this issue Nov 30, 2023 · 2 comments

Comments

@Gil3co
Copy link

Gil3co commented Nov 30, 2023

Describe the bug

When I import something from $app/forms, like enhance in one of my components, vitest tests fail.
Even when I try to mock $app/forms, it fails, without even reaching my mock.

Thank you!

Reproduction

https://github.com/Gil3co/app-forms-test-fail
To reproduce:

  1. Clone the repo and run npm i.
  2. Run npm run test and see the test fails.

Logs

This is the error:
Error: Failed to resolve import "$app/forms" from "src/routes/Component.svelte". Does the file exist?

System Info

System:
    OS: macOS 13.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 56.09 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.16.1 - ~/.nvm/versions/node/v18.16.1/bin/node
    npm: 9.7.2 - ~/.nvm/versions/node/v18.16.1/bin/npm
    bun: 1.0.8 - ~/.bun/bin/bun
  Browsers:
    Chrome: 119.0.6045.159
    Safari: 16.2
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.1 
    @sveltejs/kit: ^1.27.4 => 1.27.6 
    svelte: ^4.0.5 => 4.2.7 
    vite: ^4.4.2 => 4.5.0

Severity

annoyance

Additional Information

This is very frustrating, since I can't write tests for my project.

@eltigerchino
Copy link
Member

closed as duplicate of #1485

@eltigerchino eltigerchino closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2023
@Gil3co
Copy link
Author

Gil3co commented Dec 1, 2023

Thank you for taking the time to review my issue.
I've taken a look at #1485 and it is a duplicate of that.
Could you tell me if this is something you're taking a look at?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants