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

Most fields in Module are missing. (environment: 'node') #3440

Closed
6 tasks done
mokeyish opened this issue May 24, 2023 · 6 comments
Closed
6 tasks done

Most fields in Module are missing. (environment: 'node') #3440

mokeyish opened this issue May 24, 2023 · 6 comments

Comments

@mokeyish
Copy link

Describe the bug

图片

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-cqnkvq?file=test%2Fbasic.test.ts

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @vitest/ui: latest => 0.31.1 
    vite: latest => 4.3.8 
    vitest: latest => 0.31.1

Used Package Manager

npm

Validations

@stackblitz
Copy link

stackblitz bot commented May 24, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sheremet-va
Copy link
Member

Vitest doesn't currently support an "actual" Node environment, only those features usually needed for cross-environment code because it uses vite-node under the hood which has its own module system. For reference: #2854

@mokeyish
Copy link
Author

mokeyish commented May 24, 2023

@sheremet-va Thanks! is there an alternative to get module.path? I use the path to get test files in the relative folder.

@sheremet-va
Copy link
Member

@sheremet-va Thanks! is there an alternative to get module.path? I use the path to get test files in the relative folder.

You can get the current module path with import.meta.url

@mokeyish
Copy link
Author

You can get the current module path with import.meta.url

Thanks

@sheremet-va
Copy link
Member

Strict ESM enhancements are discussed in #2841, closing this issue for now.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants