neotest-jest icon indicating copy to clipboard operation
neotest-jest copied to clipboard

Feature Request: no extra on command

Open milafrerichs opened this issue 2 months ago • 0 comments

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: https://github.com/nvim-neotest/neotest-jest/blob/514fd4eae7da15fd409133086bb8e029b65ac43f/lua/neotest-jest/init.lua#L412-L421

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 avatar Dec 11 '24 17:12 milafrerichs