Closed tslocke closed 2 months ago
Hi, we have tried to reproduce the issue, but everything seems to be working for us with your config files and dependencies. We have created this sample repo https://github.com/wallabyjs/wallaby-3384, can you please clone, run npm i
and run Wallaby to see if it work for you? The a.test.ts
logs global crypto
object that gets into globals from JSDOM (it is not node crypto), and replicache
is built for browser, so it expects it.
If the sample repo works, please add the bits we're missing to reproduce the issue to the repo.
With that repo I'm getting:
[Info] Started Wallaby.js Core v1.0.1580
[Error] Failed to load configuration file: Automatic Vitest configuration error: Vitest dependency not found.
[Error] We've also tried to automatically configure Wallaby.js for other frameworks.
[Error] Automatic Jest configuration error: Module jest-cli is not found in '<rootDir>'.
[Error] Automatic node:test configuration error: Wallaby node:test integration requires Node.js 22.3.0 or higher.
[Error] Please refer to our docs: https://wallabyjs.com/docs/config/overview.html
Vitest is there in node_modules
I tried switching to the latest Node LTS (20.15.1) - same error
With that repo I'm getting:
This is very strange, it is a very simple repo that works for us in the same environment.
Can you please double check that you have opened the repo's root in VS Code (and not a parent or some other folder)?
Also, have you used npm
to install the dependencies?
This is very strange
That's what I thought!
Yes it's definitely the right directory open
Also, have you used npm to install the dependencies?
Yes, 10.7.0
I edited package.json so that npm test runs vitest, and that works OK from the cli.
Maybe I need to force a full reinstall of wallaby?
Very bizarre, it looks like wallaby is starting a wrong folder for some reason. Can you please try this:
wallaby.mjs
file:
import fs from "fs";
import path from "path";
console.log('cwd', process.cwd()); console.log('vitest', fs.existsSync(path.join(process.cwd(), 'node_modules/vitest')));
- run `Wallaby Select Configuration` command in the opened repo in VS Code and select `wallaby.mjs`,
- once Wallaby starts after it, open `Wallaby.js Console` output channel in VS Code and paste the output from there,
- also, after the start, please run `Wallaby Copy Diagnostics Report` in VS Code, and also paste the output.
[Info] Started Wallaby.js Core v1.0.1580 [Info] cwd /Users/tom/tmp/wallaby-3384 [Info] vitest true [Error] Failed to load configuration file: Automatic Vitest configuration error: Vitest dependency not found.
{
editorVersion: '1.89.1',
pluginVersion: '1.0.379',
editorType: 'VSCode',
osVersion: 'darwin 23.5.0',
nodeVersion: 'v20.15.1',
coreVersion: '1.0.1580',
checksum: 'MDY4NDhlNTcwYjk4YzYxNTVkNjYyYWI3M2Q2NTk4M2YsMTc0NTc5ODQwMDAwMCww',
config: { tests: [], files: [] },
packageJSON: {
dependencies: {
'@babel/standalone': '^7.24.5',
'@codemirror/lang-css': '^6.2.1',
'@codemirror/lang-javascript': '^6.2.1',
'@codemirror/theme-one-dark': '^6.1.2',
'@floating-ui/dom': '^1.2.6',
'@mhsdesign/jit-browser-tailwindcss': '^0.4.0',
'@sentry/browser': '^7',
'@sentry/tracing': '^7',
'@sentry/vite-plugin': '^2.16.0',
'@solid-primitives/scheduled': '^1.4',
'@solidjs/router': '^0.14',
'@tanstack/solid-table': '^8.19',
assert: '^2.1.0',
axios: '^1.3.6',
'babel-preset-solid': '^1.8',
'base64-js': '^1.5.1',
'browser-util-inspect': '^0.2.0',
codemirror: '^6.0.1',
'escape-html': '^1.0.3',
'fast-array-diff': '^1.1.0',
'fractional-indexing': '^3.2.0',
fuzzy: '^0.1',
'hotkeys-js': '^3.10.2',
inflection: '^2.0.1',
minisearch: '^6.0.1',
mitt: '^3.0',
nanoid: '^4.0.2',
'next-tick': '^1.1',
'prosemirror-commands': '^1.5',
'prosemirror-dropcursor': '^1.8',
'prosemirror-history': '^1.3',
'prosemirror-inputrules': '^1.4',
'prosemirror-keymap': '^1.2',
'prosemirror-model': '^1.19',
'prosemirror-state': '^1.4',
'prosemirror-transform': '^1.8',
'prosemirror-view': '^1.33',
'pusher-js': '^8.0.2',
ramda: '^0.29.0',
replicache: '^12.2.1',
'scroll-into-view-if-needed': '^3.0.10',
snabbdom: '^3.6.2',
'solid-boundaries': '^2.1.0',
'solid-js': '^1.8',
xregexp: '^5.1.1'
},
devDependencies: {
'@babel/parser': '^7.24.5',
'@babel/types': '^7.24.5',
'@lezer/generator': '^1.5.1',
'@solidjs/testing-library': '^0.8',
'@tailwindcss/forms': '^0.5',
'@tailwindcss/typography': '^0.5',
'@types/babel__standalone': '^7.1.7',
'@types/escape-html': '^1.0.2',
'@types/inflection': '^1.13.0',
'@types/json-pointer': '^1.0.31',
'@types/next-tick': '^1.0.0',
'@types/node': '^18.15.13',
'@types/object-inspect': '^1.8.1',
'@types/ramda': '^0.29.0',
autoprefixer: '^10.4',
'fake-indexeddb': '^6.0.0',
jsdom: '^24.1.0',
'json-beautify': '^1.1',
'json-pointer': '^0.6.2',
'object-inspect': '^1.12.3',
'patch-package': '^8.0.0',
postcss: '^8.4.14',
'postcss-import': '^16.1.0',
'postinstall-postinstall': '^2.1.0',
'solid-devtools': '^0.30',
'ts-unused-exports': '^9.0.4',
typescript: '^5.4',
vite: '^5.2',
'vite-plugin-solid': '^2.10',
'vite-tsconfig-paths': '^4.3',
vitest: '^1.6'
}
},
fs: { numberOfFiles: 0 },
debug: [
'2024-07-17T10:41:09.895Z project waiting for initial run signal\n',
'2024-07-17T10:41:09.922Z model Initialization Completed: 519ms\n',
'2024-07-17T10:41:09.943Z config Attempting automatic configuration for vitest\n',
'2024-07-17T10:41:09.945Z vitest/config Error: Vitest dependency not found.\n' +
' at s.configure (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:185:3465)\n' +
' at automaticConfigurationProviders.reduce.Promise.resolve.success (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:132:13094)\n' +
' at async automaticConfigurationProviders.reduce.Promise.resolve.success (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:132:12971)\n' +
' at async automaticConfigurationProviders.reduce.Promise.resolve.success (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:132:12971)\n' +
' at async automaticConfigurationProviders.reduce.Promise.resolve.success (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:132:12971)\n' +
' at async Config.load (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:132:12911)\n' +
' at async Project.configure (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:484:2644)\n',
'2024-07-17T10:41:09.945Z config Finished attempting automatic configuration for vitest (2ms)\n',
'2024-07-17T10:41:09.945Z config Attempting automatic configuration for angular\n',
'2024-07-17T10:41:09.953Z angular/cli config Angular CLI not found.\n',
'2024-07-17T10:41:09.954Z config Finished attempting automatic configuration for angular (9ms)\n',
'2024-07-17T10:41:09.954Z config Attempting automatic configuration for jest\n',
"2024-07-17T10:41:09.956Z jest/config Error: Module jest-cli is not found in '<homeDir>/tmp/wallaby-3384'.\n" +
' at Object.loadJest (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:497:1080)\n' +
' at i (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:184:24825)\n' +
' at s.configure (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:184:28164)\n' +
' at automaticConfigurationProviders.reduce.Promise.resolve.success (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:132:13094)\n' +
' at async automaticConfigurationProviders.reduce.Promise.resolve.success (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:132:12971)\n' +
' at async Config.load (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:132:12911)\n' +
' at async Project.configure (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:484:2644)\n',
'2024-07-17T10:41:09.956Z config Finished attempting automatic configuration for jest (2ms)\n',
'2024-07-17T10:41:09.956Z config Attempting automatic configuration for node:test\n',
'2024-07-17T10:41:09.957Z vitest/config Error: Wallaby node:test integration requires Node.js 22.3.0 or higher.\n' +
' at s.configure (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:185:596)\n' +
' at automaticConfigurationProviders.reduce.Promise.resolve.success (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:132:13094)\n' +
' at async Config.load (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:132:12911)\n' +
' at async Project.configure (<homeDir>/.cursor/extensions/wallabyjs.wallaby-vscode-1.0.379/wallabyf7c996/server.js:484:2644)\n',
'2024-07-17T10:41:09.957Z config Finished attempting automatic configuration for node:test (1ms)\n',
'2024-07-17T10:41:09.958Z project Failed to load configuration file: Automatic Vitest configuration error: Vitest dependency not found.\n' +
'\n' +
"We've also tried to automatically configure Wallaby.js for other frameworks.\n" +
"Automatic Jest configuration error: Module jest-cli is not found in '<rootDir>'.\n" +
'Automatic node:test configuration error: Wallaby node:test integration requires Node.js 22.3.0 or higher.\n'
]
}
BTW I am using Cursor which is a fork of vs code. I tried your repo in plain VS Code and had the same problem. I'll run your diagnostics again in regular VS code...
...yep same results.
Can you please try creating a file in your project root:
wallaby-vitest-resolve.js
const Module = require('module');
const path = require('path');
const rootEntryModule = new Module('.', null);
rootEntryModule.filename = path.join(process.cwd(), 'root.js');
rootEntryModule.paths = Module._nodeModulePaths(process.cwd());
const modulePath = Module._resolveFilename('vitest/package.json', rootEntryModule, false);
console.log(modulePath);
and then run it from the command line and share the results.
Could you also check whether you have a .pnp.*
file in any folders above your project folder? It's possible that this may cause an issue for you.
Could you also check whether you have a .pnp.* file
Great catch : ) That fixed it. Sorry for the noise.
I've started testing client side code using @solidjs/testing-library, which uses jsdom.
When I run in Wallaby I get an error: ReferenceError: crypto is not defined. It's from a library I use (Replicache)
There's no error from the command line (vitest)
As far as I understand crypto is available in Node these days. I've tried importing it and assigning to globalThis but it didn't help.
Thanks : )