quolpr / quicktest.nvim

Run your tests in split window or popup with live feedback
MIT License
66 stars 5 forks source link

Add a simple Playwright adapter #15

Closed flunderpero closed 1 month ago

flunderpero commented 1 month ago

The adapter is quite similar to vitest.

quolpr commented 1 month ago

@flunderpero thanks for the PR! Could you add an example repo to the test/support dir, so we can easily verify that plugin is working? You can take example from tests/support/ts-js-vitest. Thanks!

flunderpero commented 1 month ago

@quolpr Ah, that's what test/support is for. I added a test project.

quolpr commented 1 month ago

@flunderpero I also tried to find an option how to strip those ansi symbols:

[1/1] [chromium] › demo-todo-app.spec.ts:13:5 › New Todo should allow me to add todo items
  1 passed (1.2s)

But didn't find a way. Playwright has PLAYWRIGHT_FORCE_TTY env variable, but it didn't work for me. It seems should be a separate issue that ANSI symbols are not cutting for playwright (don't spend time on this, I will do in future).

Overall — great job! Big thank you.

quolpr commented 1 month ago

@flunderpero but actually list reporter works pretty well! Here what I changed:

local args = { "test", "--reporter=list" }

Plus:

local env_vars = vim.fn.environ()
env_vars["FORCE_COLOR"] = "true"
env_vars["PLAYWRIGHT_FORCE_TTY"] = "false"

local job = Job:new({
  ...,
  env = env_vars,
})
flunderpero commented 1 month ago

@quolpr I don't have an issue in my setup with ANSI symbols. The list reporter is the default and I think we should not force a specific reporter because that might interrupt people's workflows. I left out the changes to the command args and env because they changed nothing for me (probably because I don't have a problem with ANSI characters :-) ).

quolpr commented 1 month ago

@flunderpero got it, then let's merge. If any other users will report ANSI problems, I think I will need to change reporter or will make it configurable 🤔

Thank you for contribution!