Skip to content

Commit

Permalink
test: enable Windows examples for Bun (#13)
Browse files Browse the repository at this point in the history
* test: enable pending example

* test: enable Windows cases for Bun

* test: default to pending for windows tests

* test: enable all Windows examples
  • Loading branch information
G-Rath authored Apr 8, 2024
1 parent 18ce6bf commit 12e3425
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 55 deletions.
40 changes: 0 additions & 40 deletions spec/package_json/managers/bun_like_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@
before { allow_open3_to_receive_capture3_for_package_manager }

it "returns the version" do
skip_on_windows

expect(manager.version).to start_with("1.")
end
end

describe "#install" do
it "runs and returns true" do
skip_on_windows

with_package_json_file do
result = manager.install

Expand All @@ -34,8 +30,6 @@

it "supports frozen" do
with_package_json_file do
pending "bun currently does not support an empty lockfile - https://github.com/oven-sh/bun/issues/5162"

result = manager.install(frozen: true)

expect_manager_to_be_invoked_with("install --frozen-lockfile")
Expand All @@ -55,8 +49,6 @@

context "when the current working directory is changed" do
it "interacts with the right package.json" do
skip_on_windows

with_package_json_file do
manager # initialize the package.json in the current directory

Expand All @@ -72,8 +64,6 @@

describe "#install!" do
it "runs and returns nil" do
skip_on_windows

with_package_json_file do
expect(manager.install!).to be_nil
end
Expand Down Expand Up @@ -104,8 +94,6 @@

describe "#add" do
it "adds dependencies as production by default" do
skip_on_windows

with_package_json_file do
result = manager.add(["example"])

Expand All @@ -120,8 +108,6 @@
end

it "supports adding production dependencies" do
skip_on_windows

with_package_json_file do
result = manager.add(["example"], type: :production)

Expand All @@ -136,8 +122,6 @@
end

it "supports adding dev dependencies" do
skip_on_windows

with_package_json_file do
result = manager.add(["example"], type: :dev)

Expand All @@ -152,8 +136,6 @@
end

it "supports adding optional dependencies" do
skip_on_windows

with_package_json_file do
result = manager.add(["example"], type: :optional)

Expand Down Expand Up @@ -181,8 +163,6 @@

context "when the current working directory is changed" do
it "interacts with the right package.json" do
skip_on_windows

manager # initialize the package.json in the current directory

within_subdirectory("subdir") do
Expand All @@ -196,8 +176,6 @@

describe "#add!" do
it "returns nil" do
skip_on_windows

with_package_json_file do
expect(manager.add!(["example"])).to be_nil
end
Expand All @@ -212,8 +190,6 @@

describe "#remove" do
it "removes the package and returns true" do
skip_on_windows

with_package_json_file({ "dependencies" => { "example" => "^0.0.0", "example2" => "^0.0.0" } }) do
result = manager.remove(["example"])

Expand Down Expand Up @@ -244,8 +220,6 @@

context "when the current working directory is changed" do
it "interacts with the right package.json" do
skip_on_windows

with_package_json_file({ "dependencies" => { "example" => "^0.0.0", "example2" => "^0.0.0" } }) do
manager # initialize the package.json in the current directory

Expand All @@ -267,8 +241,6 @@

describe "#remove!" do
it "returns nil" do
skip_on_windows

with_package_json_file({ "dependencies" => { "example" => "^0.0.0", "example2" => "^0.0.0" } }) do
result = manager.remove!(["example"])

Expand Down Expand Up @@ -305,8 +277,6 @@
end

it "runs the script" do
skip_on_windows

with_package_json_file({ "scripts" => { "rspec-test-helper" => "ruby helper.rb" } }) do
result = manager.run("rspec-test-helper")

Expand All @@ -317,8 +287,6 @@
end

it "passes args correctly" do
skip_on_windows

with_package_json_file({ "scripts" => { "rspec-test-helper" => "ruby helper.rb" } }) do
result = manager.run("rspec-test-helper", ["--silent", "--flag", "value"])

Expand Down Expand Up @@ -350,8 +318,6 @@
end

it "supports the silent option" do
skip_on_windows

with_package_json_file({ "scripts" => { "rspec-test-helper" => "ruby helper.rb" } }) do
result = manager.run("rspec-test-helper", silent: true)

Expand All @@ -362,8 +328,6 @@
end

it "supports the silent option with args" do
skip_on_windows

with_package_json_file({ "scripts" => { "rspec-test-helper" => "ruby helper.rb" } }) do
result = manager.run("rspec-test-helper", ["--silent", "value", "--flag"], silent: true)

Expand All @@ -375,8 +339,6 @@

context "when the current working directory is changed" do
it "interacts with the right package.json" do
skip_on_windows

with_package_json_file({ "scripts" => { "rspec-test-helper" => "ruby helper.rb" } }) do
manager # initialize the package.json in the current directory

Expand All @@ -399,8 +361,6 @@
end

it "returns nil" do
skip_on_windows

with_package_json_file({ "scripts" => { "rspec-test-helper" => "ruby helper.rb" } }) do
result = manager.run!("rspec-test-helper")

Expand Down
4 changes: 0 additions & 4 deletions spec/package_json_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,9 @@
end

it "sets packageManager correctly when the package manager is bun" do
skip_on_windows(pend: true)

described_class.new(fallback_manager: :bun)

# :nocov:
expect_package_json_with_content({ "packageManager" => start_with("bun@1.") })
# :nocov:
end

it "raises an error if the fallback manager is not supported" do
Expand Down
11 changes: 0 additions & 11 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@
require "./spec/support/status_struct"
require "./spec/support/temp_helpers"

def skip_on_windows(pend: false)
# :nocov:
return unless Gem.win_platform?

skip "Not supported on Windows" unless pend

pending "Not supported on Windows"

# :nocov:
end

RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
Expand Down

0 comments on commit 12e3425

Please sign in to comment.