Skip to content

KostkaBrukowa/neotest-jest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

neotest-jest

build

This plugin provides a jest adapter for the Neotest framework. It is currently a work in progress. It will be transferred to the official neotest organisation (once it's been created).

Installation

Using packer:

use({
  'nvim-neotest/neotest',
  requires = {
    ...,
    'haydenmeade/neotest-jest',
  }
  config = function()
    require('neotest').setup({
      ...,
      adapters = {
        require('neotest-jest')({
          jestCommand = "npm test --",
          jestConfigFile = "custom.jest.config.ts",
          env = { CI = true },
          cwd = function(path)
            return vim.fn.getcwd()
          end,
        }),
      }
    })
  end
})

Usage

See neotest's documentation for more information on how to run tests.

Running tests in watch mode

jest allows to run your tests in watch mode. To run test in this mode you either can enable it globally in the setup:

require('neotest').setup({
  ...,
  adapters = {
    require('neotest-jest')({
      jestCommand = "jest --watch ",
    }),
  }
})

or add a specific keymap to run tests with watch mode:

vim.api.nvim_set_keymap("n", "<leader>tw", "<cmd>lua require('neotest').run.run({ jestCommand = 'jest --watch ' })<cr>", {})

🎁 Contributing

Please raise a PR if you are interested in adding new functionality or fixing any bugs. When submitting a bug, please include an example spec that can be tested.

To trigger the tests for the adapter, run:

./scripts/test

Bug Reports

Please file any bug reports and I might take a look if time permits otherwise please submit a PR, this plugin is intended to be by the community for the community.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 94.1%
  • TypeScript 3.6%
  • Shell 2.0%
  • Vim Script 0.3%