Skip to content

Commit 4ba28c8

Browse files
committed
Fix platform-dependent test for CI (Linux)
1 parent 98c5733 commit 4ba28c8

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

test/npm/platform_optional_test.exs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,24 @@ defmodule NPM.PlatformOptionalTest do
4545
:ets.insert(:npm_resolver_cache, {"@oxfmt/binding-darwin-arm64", darwin})
4646
:ets.insert(:npm_resolver_cache, {"@oxfmt/binding-linux-x64-gnu", linux})
4747

48+
{expected_name, other_name} =
49+
case :os.type() do
50+
{:unix, :darwin} ->
51+
{"@oxfmt/binding-darwin-arm64", "@oxfmt/binding-linux-x64-gnu"}
52+
53+
{:unix, :linux} ->
54+
{"@oxfmt/binding-linux-x64-gnu", "@oxfmt/binding-darwin-arm64"}
55+
end
56+
4857
selected =
4958
NPM.PlatformOptional.select(%{
5059
"@oxfmt/binding-darwin-arm64" => "0.37.0",
5160
"@oxfmt/binding-linux-x64-gnu" => "0.37.0"
5261
})
5362

54-
assert selected == %{"@oxfmt/binding-darwin-arm64" => "0.37.0"}
55-
assert NPM.PlatformOptional.current_match("@oxfmt/binding-darwin-arm64")
56-
refute NPM.PlatformOptional.current_match("@oxfmt/binding-linux-x64-gnu")
63+
assert selected == %{expected_name => "0.37.0"}
64+
assert NPM.PlatformOptional.current_match(expected_name)
65+
refute NPM.PlatformOptional.current_match(other_name)
5766
after
5867
NPM.Resolver.clear_cache()
5968
end

0 commit comments

Comments
 (0)