We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to run some unit tests using neotest-jest, and I can't see the test results for some reason when using describe.each.
When running a test, such as:
import { sum } from '../src/AlgorithmsInTypescript/math' describe('test sum module',() =>{ test('1 + 2 should equal 3',()=> { const [a,b] = [1,2] expect(sum(a,b)).toBe(3) }) })
I can see the tests running fine.
However, if I run the following test:
import groupAnagrams from '../src/AlgorithmsInTypescript/GroupAnagrams' const testCases = [ { input: ['abc', 'cba', 'bca', 'xyz', 'yxz', 'zxy'], output: [ ['abc', 'cba', 'bca'], ['xyz', 'yxz', 'zxy'], ], }, { input: ['rat', 'tar', 'art', 'star', 'tars', 'rats'], output: [ ['rat', 'tar', 'art'], ['star', 'tars', 'rats'], ], }, { input: ['no', 'on', 'is', 'si', 'at', 'ta'], output: [ ['no', 'on'], ['is', 'si'], ['at', 'ta'], ], }, { input: ['bored', 'robed', 'debit card', 'bad credit', 'earth', 'heart'], output: [ ['bored', 'robed'], ['debit card', 'bad credit'], ['earth', 'heart'], ], }, { input: [''], output: [['']], }, { input: ['a', 'b', 'c', 'a', 'b', 'c'], output: [ ['a', 'a'], ['b', 'b'], ['c', 'c'], ], }, { input: ['apple', 'paple', 'pale', 'leap', 'peal'], output: [ ['apple', 'paple'], ['pale', 'leap', 'peal'], ], }, ] describe.each(testCases)('Test group anagrams', ({ input, output }) => { it(`The input: ${input} should return ${output}`, () => { const result = groupAnagrams(input) const resultGroups = result.map((group) => new Set(group)) const expectedGroups = output.map((group) => new Set(group)) expectedGroups.forEach((expectedGroup) => { expect(resultGroups).toEqual( expect.arrayContaining([ expect.objectContaining({ size: expectedGroup.size, ...expectedGroup, }), ]), ) }) resultGroups.forEach((resultGroup) => { expect(expectedGroups).toEqual( expect.arrayContaining([ expect.objectContaining({ size: resultGroup.size, ...resultGroup }), ]), ) }) }) })
I don't see the result if I run it via Neo-Test Jest, and it gives me a blue icon in the test explorer. It will work if I run the test via CLI.
Below is my lua config with lazy for Neotest jest showing how I configured it.
return { -- Main testing dependency "nvim-neotest/neotest", dependencies = { "nvim-neotest/nvim-nio", "nvim-lua/plenary.nvim", "antoinemadec/FixCursorHold.nvim", "nvim-treesitter/nvim-treesitter", "nvim-neotest/neotest-jest", "Issafalcon/neotest-dotnet" }, config = function() require("neotest").setup({ adapters = { require("neotest-dotnet")({ discovery_root = 'solution' }), require("neotest-jest")({ jestCommand = "yarn test", -- Adjust this based on your npm command jestConfigFile = "jest.config.js", -- If you have a Jest config file env = { CI = true }, cwd = function(path) -- Assuming tests are in a 'tests' folder local relative_path = vim.fn.fnamemodify(path, ":~:.") if string.match(relative_path, "^tests/") then return vim.fn.getcwd() end return vim.fn.getcwd() end, }), }, }) end, }
The text was updated successfully, but these errors were encountered:
Hello @tweiss777, did you manage to make this work? Have you tried setting jest_test_discovery ?
jest_test_discovery
require('neotest-jest')({ ..., jest_test_discovery = true, }),
https://github.com/nvim-neotest/neotest-jest?tab=readme-ov-file#parameterized-tests
Sorry, something went wrong.
Actually I have the same issue, even with jest_test_discovery set, the tests are not displayed as expected
No branches or pull requests
I'm trying to run some unit tests using neotest-jest, and I can't see the test results for some reason when using describe.each.
When running a test, such as:
I can see the tests running fine.
However, if I run the following test:
I don't see the result if I run it via Neo-Test Jest, and it gives me a blue icon in the test explorer. It will work if I run the test via CLI.
Below is my lua config with lazy for Neotest jest showing how I configured it.
The text was updated successfully, but these errors were encountered: