Skip to content

Commit

Permalink
👷 Fix test workflow (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
marilari88 authored Feb 18, 2024
1 parent 5135c0d commit 1c50f89
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- os: ubuntu-20.04
url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
- os: ubuntu-20.04
url: https://github.com/neovim/neovim/releases/download/v0.7.0/nvim-linux64.tar.gz
url: https://github.com/neovim/neovim/releases/download/v0.9.5/nvim-linux64.tar.gz

steps:
- uses: actions/checkout@v2
Expand Down
31 changes: 20 additions & 11 deletions tests/init_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,39 @@ A = function(...)
end

describe("adapter enabled", function()
async.it("enable adapter", function()
async.it("vitest simple repo", function()
assert.Not.Nil(plugin.root("./spec"))
end)

async.it("disable adapter", function()
assert.Nil(plugin.root("./spec-jest"))
end)

async.it("disable adapter no package.json", function()
assert.Nil(plugin.root("."))
end)

async.it("enable adapter for monorepo with vitest at root", function()
assert.Not.Nil(plugin.root("./spec-monorepo"))
end)
end)

describe("is_test_file", function()
it("matches vitest files", function()
assert.True(plugin.is_test_file("./spec/basic.test.ts"))
async.it("matches vitest files", function()
assert.is.truthy(plugin.is_test_file("./spec/basic.test.ts"))
end)

async.it("does not match plain js files", function()
assert.is.falsy(plugin.is_test_file("./index.ts"))
end)

async.it("does not match file name ending with test", function()
assert.is.falsy(plugin.is_test_file("./setupVitest.ts"))
end)

it("does not match plain js files", function()
assert.False(plugin.is_test_file("./index.ts"))
async.it("does not match test in repo with jest", function()
assert.is.falsy(plugin.is_test_file("./spec-jest/basic.test.ts"))
end)

it("does not match file name ending with test", function()
assert.False(plugin.is_test_file("./setupVitest.ts"))
async.it("matches vitest files in monorepo", function()
assert.is.truthy(plugin.is_test_file("./spec-monorepo/packages/example/basic.test.ts"))
assert.is.truthy(plugin.is_test_file("./spec-monorepo/apps/todo/todo.test.tsx"))
end)
end)

Expand Down

0 comments on commit 1c50f89

Please sign in to comment.