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

Feature Request: no extra on command #131

Open
milafrerichs opened this issue Dec 11, 2024 · 0 comments
Open

Feature Request: no extra on command #131

milafrerichs opened this issue Dec 11, 2024 · 0 comments

Comments

@milafrerichs
Copy link

Hey,

thanks for this awesome adapter and the whole neotest package.
I have a weird project I'm working on that is using nx and I cannot use this project unless I patch it.

Because we run the tests with npx nx run package_name:test --test-file fileName

But with the additional commands you add to the jestCommand here:

vim.list_extend(command, {
"--no-coverage",
"--testLocationInResults",
"--verbose",
"--json",
"--outputFile=" .. results_path,
"--testNamePattern=" .. testNamePattern,
"--forceExit",
escapeTestPattern(vim.fs.normalize(pos.path)),
})

it fails because --json is not the way to do it with nx but rather --json=true

Would you accept a PR that adds a config flag to not include these extra commands?

adapters = {
  require('neotest-jest')({
    no_extra = true,
    ...
    })
}

and then check in the init.lua

	if no_extra then
		vim.list_extend(command, {
			"--outputFile=" .. results_path,
			"--testNamePattern=" .. testNamePattern,
			escapeTestPattern(vim.fs.normalize(pos.path))
		})
	else
		vim.list_extend(command, {
			"--no-coverage",
			"--testLocationInResults",
			"--verbose",
			"--json",
			"--outputFile=" .. results_path,
			"--testNamePattern=" .. testNamePattern,
			"--forceExit",
			escapeTestPattern(vim.fs.normalize(pos.path)),
		})
	end

Thanks for your time. Feel free to close this issue if you don't want such a PR.

@milafrerichs milafrerichs changed the title Feature Request Feature Request: no extra on command Dec 11, 2024
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