aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-12-26 16:35:10 +0100
committerGitHub <noreply@github.com>2022-12-26 16:35:10 +0100
commit6ee823248f5fc433018ee800c22eef642e375bd1 (patch)
tree7bd52d934e4fb335cf9ef4df32752e28aaa80224 /tests
parentrefactor(async): error with stack level 0 (#801) (diff)
downloadmason-6ee823248f5fc433018ee800c22eef642e375bd1.tar
mason-6ee823248f5fc433018ee800c22eef642e375bd1.tar.gz
mason-6ee823248f5fc433018ee800c22eef642e375bd1.tar.bz2
mason-6ee823248f5fc433018ee800c22eef642e375bd1.tar.lz
mason-6ee823248f5fc433018ee800c22eef642e375bd1.tar.xz
mason-6ee823248f5fc433018ee800c22eef642e375bd1.tar.zst
mason-6ee823248f5fc433018ee800c22eef642e375bd1.zip
refactor(installer): introduce PackageInstallOpts class (#802)
Diffstat (limited to 'tests')
-rw-r--r--tests/helpers/lua/test_helpers.lua2
-rw-r--r--tests/mason-core/managers/cargo_spec.lua6
-rw-r--r--tests/mason-core/managers/composer_spec.lua4
-rw-r--r--tests/mason-core/managers/dotnet_spec.lua4
-rw-r--r--tests/mason-core/managers/gem_spec.lua4
-rw-r--r--tests/mason-core/managers/git_spec.lua2
-rw-r--r--tests/mason-core/managers/go_spec.lua4
-rw-r--r--tests/mason-core/managers/luarocks_spec.lua2
-rw-r--r--tests/mason-core/managers/npm_spec.lua6
-rw-r--r--tests/mason-core/managers/opam_spec.lua4
-rw-r--r--tests/mason-core/managers/pip3_spec.lua4
11 files changed, 21 insertions, 21 deletions
diff --git a/tests/helpers/lua/test_helpers.lua b/tests/helpers/lua/test_helpers.lua
index fcb6a608..17ec5ae5 100644
--- a/tests/helpers/lua/test_helpers.lua
+++ b/tests/helpers/lua/test_helpers.lua
@@ -40,7 +40,7 @@ end
-- selene: allow(unused_variable)
---@param handle InstallHandle
----@param opts InstallContextOpts?
+---@param opts PackageInstallOpts?
function InstallContextGenerator(handle, opts)
local context = InstallContext.new(handle, opts or {})
context.spawn = setmetatable({}, {
diff --git a/tests/mason-core/managers/cargo_spec.lua b/tests/mason-core/managers/cargo_spec.lua
index d52c6ffc..b5b07cf1 100644
--- a/tests/mason-core/managers/cargo_spec.lua
+++ b/tests/mason-core/managers/cargo_spec.lua
@@ -17,7 +17,7 @@ describe("cargo manager", function()
"should call cargo install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, cargo.crate "my-crate")
assert.spy(ctx.spawn.cargo).was_called(1)
assert.spy(ctx.spawn.cargo).was_called_with {
@@ -77,7 +77,7 @@ describe("cargo manager", function()
"should respect options",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, cargo.crate("my-crate", { features = "lsp" }))
assert.spy(ctx.spawn.cargo).was_called(1)
assert.spy(ctx.spawn.cargo).was_called_with {
@@ -99,7 +99,7 @@ describe("cargo manager", function()
local handle = InstallHandleGenerator "dummy"
stub(github, "tag")
github.tag.returns { tag = "v2.1.1", with_receipt = mockx.just_runs }
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
cargo.crate("my-crate", {
diff --git a/tests/mason-core/managers/composer_spec.lua b/tests/mason-core/managers/composer_spec.lua
index 0c741493..44841061 100644
--- a/tests/mason-core/managers/composer_spec.lua
+++ b/tests/mason-core/managers/composer_spec.lua
@@ -12,7 +12,7 @@ describe("composer manager", function()
"should call composer require",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
ctx.fs.file_exists = spy.new(mockx.returns(false))
installer.exec_in_context(
ctx,
@@ -39,7 +39,7 @@ describe("composer manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
composer.packages { "main-package", "supporting-package", "supporting-package2" }
diff --git a/tests/mason-core/managers/dotnet_spec.lua b/tests/mason-core/managers/dotnet_spec.lua
index ffcbd339..17f7cd3b 100644
--- a/tests/mason-core/managers/dotnet_spec.lua
+++ b/tests/mason-core/managers/dotnet_spec.lua
@@ -6,7 +6,7 @@ describe("dotnet manager", function()
"should call dotnet tool update",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, dotnet.package "main-package")
assert.spy(ctx.spawn.dotnet).was_called(1)
assert.spy(ctx.spawn.dotnet).was_called_with {
@@ -24,7 +24,7 @@ describe("dotnet manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, dotnet.package "main-package")
assert.same({
type = "dotnet",
diff --git a/tests/mason-core/managers/gem_spec.lua b/tests/mason-core/managers/gem_spec.lua
index a74425e5..93973b3e 100644
--- a/tests/mason-core/managers/gem_spec.lua
+++ b/tests/mason-core/managers/gem_spec.lua
@@ -14,7 +14,7 @@ describe("gem manager", function()
"should call gem install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, gem.packages { "main-package", "supporting-package", "supporting-package2" })
assert.spy(ctx.spawn.gem).was_called(1)
assert.spy(ctx.spawn.gem).was_called_with(match.tbl_containing {
@@ -37,7 +37,7 @@ describe("gem manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, gem.packages { "main-package", "supporting-package", "supporting-package2" })
assert.same({
type = "gem",
diff --git a/tests/mason-core/managers/git_spec.lua b/tests/mason-core/managers/git_spec.lua
index 684d0e54..ec157ecc 100644
--- a/tests/mason-core/managers/git_spec.lua
+++ b/tests/mason-core/managers/git_spec.lua
@@ -47,7 +47,7 @@ describe("git manager", function()
"should fetch and checkout revision if requested",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "1337" })
+ local ctx = InstallContextGenerator(handle, { version = "1337" })
installer.exec_in_context(ctx, function()
git.clone { "https://github.com/williamboman/mason.nvim.git" }
end)
diff --git a/tests/mason-core/managers/go_spec.lua b/tests/mason-core/managers/go_spec.lua
index 21547204..6a7f0a9c 100644
--- a/tests/mason-core/managers/go_spec.lua
+++ b/tests/mason-core/managers/go_spec.lua
@@ -12,7 +12,7 @@ describe("go manager", function()
"should call go install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, go.packages { "main-package", "supporting-package", "supporting-package2" })
assert.spy(ctx.spawn.go).was_called(3)
assert.spy(ctx.spawn.go).was_called_with {
@@ -40,7 +40,7 @@ describe("go manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, go.packages { "main-package", "supporting-package", "supporting-package2" })
assert.same({
type = "go",
diff --git a/tests/mason-core/managers/luarocks_spec.lua b/tests/mason-core/managers/luarocks_spec.lua
index 9065ca69..98376adc 100644
--- a/tests/mason-core/managers/luarocks_spec.lua
+++ b/tests/mason-core/managers/luarocks_spec.lua
@@ -26,7 +26,7 @@ describe("luarocks manager", function()
"should install provided version",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "1.2.3" })
+ local ctx = InstallContextGenerator(handle, { version = "1.2.3" })
installer.exec_in_context(ctx, luarocks.package "lua-cjson")
assert.spy(ctx.spawn.luarocks).was_called(1)
assert.spy(ctx.spawn.luarocks).was_called_with {
diff --git a/tests/mason-core/managers/npm_spec.lua b/tests/mason-core/managers/npm_spec.lua
index 971e255f..6bfa518d 100644
--- a/tests/mason-core/managers/npm_spec.lua
+++ b/tests/mason-core/managers/npm_spec.lua
@@ -14,7 +14,7 @@ describe("npm manager", function()
"should call npm install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, npm.packages { "main-package", "supporting-package", "supporting-package2" })
assert.spy(ctx.spawn.npm).was_called_with(match.tbl_containing {
"install",
@@ -49,7 +49,7 @@ describe("npm manager", function()
"should append .npmrc file",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
ctx.fs.append_file = spy.new(mockx.just_runs())
installer.exec_in_context(ctx, npm.packages { "main-package", "supporting-package", "supporting-package2" })
assert.spy(ctx.fs.append_file).was_called(1)
@@ -61,7 +61,7 @@ describe("npm manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(ctx, npm.packages { "main-package", "supporting-package", "supporting-package2" })
assert.same({
type = "npm",
diff --git a/tests/mason-core/managers/opam_spec.lua b/tests/mason-core/managers/opam_spec.lua
index 1aa9bb93..22d0a55b 100644
--- a/tests/mason-core/managers/opam_spec.lua
+++ b/tests/mason-core/managers/opam_spec.lua
@@ -7,7 +7,7 @@ describe("opam manager", function()
"should call opam install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
opam.packages { "main-package", "supporting-package", "supporting-package2" }
@@ -31,7 +31,7 @@ describe("opam manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
opam.packages { "main-package", "supporting-package", "supporting-package2" }
diff --git a/tests/mason-core/managers/pip3_spec.lua b/tests/mason-core/managers/pip3_spec.lua
index de0de5c7..7422084f 100644
--- a/tests/mason-core/managers/pip3_spec.lua
+++ b/tests/mason-core/managers/pip3_spec.lua
@@ -28,7 +28,7 @@ describe("pip3 manager", function()
"should create venv and call pip3 install",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
pip3.packages { "main-package", "supporting-package", "supporting-package2" }
@@ -177,7 +177,7 @@ describe("pip3 manager", function()
"should provide receipt information",
async_test(function()
local handle = InstallHandleGenerator "dummy"
- local ctx = InstallContextGenerator(handle, { requested_version = "42.13.37" })
+ local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
installer.exec_in_context(
ctx,
pip3.packages { "main-package", "supporting-package", "supporting-package2" }