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

Validation error when running vite-jest #29

Open
dospunk opened this issue Oct 21, 2021 · 1 comment
Open

Validation error when running vite-jest #29

dospunk opened this issue Oct 21, 2021 · 1 comment

Comments

@dospunk
Copy link

dospunk commented Oct 21, 2021

When I try to run vite-jest I'm getting this error:

 Validation Error:

  Module /path-to-my-repo/node_modules/vite-jest/index.js in the transform option was not found.
         <rootDir> is: path-to-my-repo

  Configuration Documentation:
  https://jestjs.io/docs/configuration

path-to-my-repo\node_modules\execa\lib\error.js:60
                error = new Error(message);
                        ^

Error: Command failed with exit code 1: node --experimental-vm-modules path-to-my-repo\node_modules\jest\bin\jest.js
    at makeError (path-to-my-repo\node_modules\execa\lib\error.js:60:11)
    at Function.module.exports.sync (path-to-my-repo\node_modules\execa\index.js:194:17)
    at file:///path-to-my-repo/node_modules/vite-jest/bin/vite-jest.js:11:7
    at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
    at async Loader.import (node:internal/modules/esm/loader:178:24)
    at async Object.loadESM (node:internal/process/esm_loader:68:5)
    at async handleMainPromise (node:internal/modules/run_main:63:12) {
  shortMessage: 'Command failed with exit code 1: node --experimental-vm-modules path-to-my-repo\\node_modules\\jest\\bin\\jest.js',
  command: 'node --experimental-vm-modules path-to-my-repo\\node_modules\\jest\\bin\\jest.js',
  escapedCommand: 'node --experimental-vm-modules "path-to-my-repo\\node_modules\\jest\\bin\\jest.js"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

It seems to suggest that vite-jest isn't installed, but it is so I'm kind of at a loss

@jacokok
Copy link

jacokok commented Oct 27, 2021

Try changing your preset in jest.config.js to the below.

preset: "./node_modules/vite-jest/index.js",

This worked for me. Saw this at #10

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