nvim-neotest / neotest

An extensible framework for interacting with tests within NeoVim.
MIT License
2.13k stars 105 forks source link

add status constants #334

Closed TheSnakeWitcher closed 6 months ago

TheSnakeWitcher commented 6 months ago

Hi, I am developing an adapter to integrate neotest with hardhat. I have a code like these

M.STATUS = {
    passed = "passed",
    skiped = "skipped",
    failed = "failed",
}

And I found that neotest-go adapter here has a code like these

local test_statuses = {
   -- ...
  pass = "passed", -- the test passed
  fail = "failed", -- the test or benchmark failed
  skip = "skipped", -- the test was skipped or the package contained no tests
}

I think that probably other adapters use similar declarations to set the status field of a neotest.Result Maybe these constants could be defined in neotest, that way all plugins could use it and we avoid code duplication, maybe a module like neotest.lib.constants would be cool.

I personally use these other constants too when computing command field of the neotest.RunSpec.

NODE_TYPES = {
    dir = "dir",
    file = "file",
    namespace = "namespace",
    test = "test",
}
rcarriga commented 6 months ago

I've added enums for both to neotest.types :smile:

TheSnakeWitcher commented 6 months ago

Nice work, chears :smile: