1
0
Fork 0
mirror of https://github.com/pnx/neotest-phpunit synced 2026-06-16 03:54:55 +02:00
No description
Find a file
2024-02-17 17:02:32 -05:00
.github/workflows Add github workflow 2022-11-17 01:36:49 +03:00
lua/neotest-pest Use vim-notify when errors happen 2024-02-17 17:02:32 -05:00
scripts Make tests work with minimal_init.vim 2022-11-24 10:52:38 +03:00
specs Make tests work with minimal_init.vim 2022-11-24 10:52:38 +03:00
src Pest runs with dummy code 2022-11-14 22:24:22 +03:00
tests Get better short message output 2022-11-17 00:39:51 +03:00
.gitignore Ignore phpunit cache 2022-11-14 22:17:39 +03:00
.stylua.toml Add stylua 2022-11-14 22:15:39 +03:00
composer.json Update neotest-pest to work with Pest 2.0 2024-02-05 17:02:48 -05:00
composer.lock Update neotest-pest to work with Pest 2.0 2024-02-05 17:02:48 -05:00
LICENSE Initial commit 2022-11-14 21:42:49 +03:00
phpstan.neon Setup phpstan and pint 2022-11-15 15:08:38 +03:00
phpunit.xml Further simplification 2024-02-17 13:28:03 -05:00
phpunit.xml.bak Further simplification 2024-02-17 13:28:03 -05:00
README.md Update readme 2024-02-07 16:15:22 -05:00

neotest-pest

This plugin provides a Pest adapter for the Neotest framework.

This is a fork of neotest-pest originally by @theutz, with some fixes and updates:

  • Updated to work with Pest 2.0
  • Support for (and automatic detection of) Laravel Sail
    • Note: This also moves junit output files into storage/app/

⚠️ Ive only focused on making this work for me. Please test against your Pest tests ⚠️

📦 Installation

Install the plugin using packer:

use({
  'nvim-neotest/neotest',
  requires = {
    ...,
    'V13Axel/neotest-pest',
  },
  config = function()
    require('neotest').setup({
      ...,
      adapters = {
        require('neotest-pest'),
      }
    })
  end
})

🔧 Configuration

The plugin may be configured as below:

adapters = {
  require('neotest-pest')({
    pest_cmd = function()
      return "vendor/bin/pest"
    end
  }),
}

🚀 Usage

Test single method

To test a single test, hover over the test and run lua require('neotest').run.run().

As an example, I have mine setup with t(est)n(earest) as such:

vim.keymap.set('n', '<leader>tn', function() require('neotest').run.run() end)

Test file

To test a file run lua require('neotest').run.run(vim.fn.expand('%'))

Example - t(est)f(ile):

vim.keymap.set('n', '<leader>tf', function() require('neotest').run.run(vim.fn.expand('%')) end)

Test directory

To test a directory run lua require('neotest').run.run("path/to/directory")

Test suite

To test the full test suite run lua require('neotest').run.run({ suite = true })

🎁 Contributing

This fork is maintained by one guy, in my spare time and when I can get to it. Please raise a PR if you are interested in adding new functionality or fixing any bugs. When submitting a bug, please include an example test that I can test against.

To trigger the tests for the adapter, run:

./scripts/test

👏 Prior Art

This package is a fork of neotest-pest by @theutz, which relied heavily on olimorris/neotest-phpunit by @olimorris.