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

Passing args to vitest...? #3105

Closed
martaver opened this issue Nov 17, 2022 · 1 comment
Closed

Passing args to vitest...? #3105

martaver opened this issue Nov 17, 2022 · 1 comment

Comments

@martaver
Copy link

martaver commented Nov 17, 2022

I'm using wallaby in vscode versopm v1.0.348 together with vitest 0.25.2.

I have a test that uses a package with a node native extension that causes a SIGSEGV seg fault when run in vitest (similar situation to vitest-dev/vitest#317). I'm unsure where the blame lies, but it seems like a vitest problem. I can use the package fine in Quokka or with ts-node.

Either way, the solution is to pass --segfault-retry 1 to vitest or set env var VITEST_SEGFAULT_RETRY for vitest's process.

I'm using automatic configuration, and would like to just simply pass segault-retry by arg or env var to vite when wallaby runs.

Is there a way to do this and keep using automatic configuration without having to set up a full wallaby.config.js?

@martaver
Copy link
Author

Updating...

Added this to my package.json:

"wallaby": {		
		"env": {
			"params": {
				"env": "VITEST_SEGFAULT_RETRY=1"
			}
		}
	}

however that results in

‍​[Info]​ Started Wallaby.js Core v1.0.1345
​[Info]​ Wallaby App (realtime reports) is available at: http://localhost:51245
​​[Error] Runtime error: Failed to initialize wallaby vitest.​​
​​[Error] dependency.startVitest is not a function​​
​​[Error] TypeError: dependency.startVitest is not a function​​

If I create wallaby.cjs, set process.env in that, and then point Select Configuration to it, then the test passes once... occasionally... that is to say I couldn't determine what factor allowed it to run without error, but subsequent attempts with the same configuration mostly failed.
wallaby.cjs:

process.env['VITEST_SEGFAULT_RETRY'] = "1"

console.log('Configuring...');

module.exports = () => ({
    autoDetect: true,    
 });

However, when the test did run, then subsequent runs cause vitest's cache to be corrupted:

​[Info]​ console.error: [vitest] Error, while trying to parse cache in /Users/sebastian.nemeth/Projects/org/cleric/core/core/apps/www/node_modules/.vitest/results.json: [SyntaxError: Unexpected end of JSON input]

At this point, I started to suspect that vitest is to blame. Indeed, vitest won't watch with --segfault-retry set, either.

So I think it's safe to say that this ticket is closed, and maybe I should try jest.

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

1 participant