shakapacker 8.0.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/dummy.yml +1 -1
- data/.github/workflows/generator.yml +5 -1
- data/.github/workflows/node.yml +1 -1
- data/.github/workflows/ruby.yml +8 -2
- data/.gitignore +0 -1
- data/.node-version +1 -1
- data/CHANGELOG.md +21 -12
- data/Gemfile.lock +257 -0
- data/README.md +11 -12
- data/docs/customizing_babel_config.md +32 -4
- data/docs/react.md +3 -2
- data/docs/troubleshooting.md +1 -1
- data/docs/v8_upgrade.md +2 -2
- data/lib/shakapacker/version.rb +1 -1
- data/package.json +2 -2
- data/shakapacker.gemspec +5 -2
- metadata +5 -235
- data/lib/install/bin/yarn +0 -18
- data/rakelib/release.rake +0 -65
- data/spec/dummy/.browserslistrc +0 -1
- data/spec/dummy/.gitignore +0 -20
- data/spec/dummy/.prettierrc.yaml +0 -4
- data/spec/dummy/Gemfile +0 -61
- data/spec/dummy/Procfile.dev +0 -5
- data/spec/dummy/Procfile.dev-static +0 -9
- data/spec/dummy/README.md +0 -1
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/config/manifest.js +0 -2
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/channels/application_cable/channel.rb +0 -4
- data/spec/dummy/app/channels/application_cable/connection.rb +0 -4
- data/spec/dummy/app/controllers/application_controller.rb +0 -2
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/hello_world_controller.rb +0 -9
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/javascript/Globals.d.ts +0 -3
- data/spec/dummy/app/javascript/bundles/HelloWorld/components/HelloWorld.module.css +0 -25
- data/spec/dummy/app/javascript/bundles/HelloWorld/components/HelloWorld.tsx +0 -47
- data/spec/dummy/app/javascript/bundles/HelloWorld/components/HelloWorldServer.tsx +0 -5
- data/spec/dummy/app/javascript/bundles/HelloWorld/components/logo.svg +0 -7
- data/spec/dummy/app/javascript/packs/application.js +0 -17
- data/spec/dummy/app/javascript/packs/hello-world-bundle.ts +0 -8
- data/spec/dummy/app/javascript/packs/server-bundle.ts +0 -8
- data/spec/dummy/app/jobs/application_job.rb +0 -7
- data/spec/dummy/app/mailers/application_mailer.rb +0 -4
- data/spec/dummy/app/models/application_record.rb +0 -3
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/hello_world/index.html.erb +0 -2
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/app/views/layouts/hello_world.html.erb +0 -13
- data/spec/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/spec/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/spec/dummy/babel.config.js +0 -30
- data/spec/dummy/bin/bundle +0 -114
- data/spec/dummy/bin/dev +0 -30
- data/spec/dummy/bin/dev-static +0 -30
- data/spec/dummy/bin/rails +0 -9
- data/spec/dummy/bin/rake +0 -9
- data/spec/dummy/bin/setup +0 -33
- data/spec/dummy/bin/shakapacker +0 -13
- data/spec/dummy/bin/shakapacker-dev-server +0 -13
- data/spec/dummy/bin/spring +0 -17
- data/spec/dummy/bin/yarn +0 -18
- data/spec/dummy/config/application.rb +0 -35
- data/spec/dummy/config/boot.rb +0 -4
- data/spec/dummy/config/cable.yml +0 -10
- data/spec/dummy/config/credentials.yml.enc +0 -1
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -54
- data/spec/dummy/config/environments/production.rb +0 -106
- data/spec/dummy/config/environments/test.rb +0 -49
- data/spec/dummy/config/initializers/application_controller_renderer.rb +0 -8
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/content_security_policy.rb +0 -28
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -5
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/react_on_rails.rb +0 -58
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -33
- data/spec/dummy/config/puma.rb +0 -38
- data/spec/dummy/config/routes.rb +0 -6
- data/spec/dummy/config/shakapacker.yml +0 -61
- data/spec/dummy/config/spring.rb +0 -6
- data/spec/dummy/config/storage.yml +0 -34
- data/spec/dummy/config/webpack/ServerClientOrBoth.js +0 -34
- data/spec/dummy/config/webpack/clientWebpackConfig.js +0 -15
- data/spec/dummy/config/webpack/commonWebpackConfig.js +0 -17
- data/spec/dummy/config/webpack/development.js +0 -32
- data/spec/dummy/config/webpack/production.js +0 -9
- data/spec/dummy/config/webpack/serverWebpackConfig.js +0 -116
- data/spec/dummy/config/webpack/test.js +0 -7
- data/spec/dummy/config/webpack/webpack.config.js +0 -24
- data/spec/dummy/config.ru +0 -5
- data/spec/dummy/db/seeds.rb +0 -7
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/lib/tasks/.keep +0 -0
- data/spec/dummy/package.json +0 -44
- data/spec/dummy/postcss.config.js +0 -12
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +0 -1
- data/spec/dummy/spec/rails_helper.rb +0 -118
- data/spec/dummy/spec/spec_helper.rb +0 -96
- data/spec/dummy/spec/system/hello_world_spec.rb +0 -19
- data/spec/dummy/tsconfig.json +0 -21
- data/spec/dummy/vendor/.keep +0 -0
- data/spec/dummy/yarn.lock +0 -4696
- data/spec/fixtures/beta_package-lock.v1.json +0 -119
- data/spec/fixtures/beta_package-lock.v2.json +0 -6777
- data/spec/fixtures/beta_package.json +0 -13
- data/spec/fixtures/beta_pnpm-lock.v7.yaml +0 -116
- data/spec/fixtures/beta_pnpm-lock.v8.yaml +0 -2537
- data/spec/fixtures/beta_pnpm-lock.v9.yaml +0 -2885
- data/spec/fixtures/beta_yarn.v1.lock +0 -106
- data/spec/fixtures/beta_yarn.v2.lock +0 -164
- data/spec/fixtures/git_url_package-lock.v1.json +0 -118
- data/spec/fixtures/git_url_package-lock.v2.json +0 -10263
- data/spec/fixtures/git_url_package.json +0 -13
- data/spec/fixtures/git_url_pnpm-lock.v7.yaml +0 -126
- data/spec/fixtures/git_url_pnpm-lock.v8.yaml +0 -3728
- data/spec/fixtures/git_url_pnpm-lock.v9.yaml +0 -4544
- data/spec/fixtures/git_url_yarn.v1.lock +0 -106
- data/spec/fixtures/git_url_yarn.v2.lock +0 -165
- data/spec/fixtures/github_url_package-lock.v1.json +0 -118
- data/spec/fixtures/github_url_package-lock.v2.json +0 -10263
- data/spec/fixtures/github_url_package.json +0 -13
- data/spec/fixtures/github_url_pnpm-lock.v7.yaml +0 -126
- data/spec/fixtures/github_url_pnpm-lock.v8.yaml +0 -3728
- data/spec/fixtures/github_url_pnpm-lock.v9.yaml +0 -4544
- data/spec/fixtures/github_url_yarn.v1.lock +0 -105
- data/spec/fixtures/github_url_yarn.v2.lock +0 -165
- data/spec/fixtures/relative_path_package-lock.v1.json +0 -3468
- data/spec/fixtures/relative_path_package-lock.v2.json +0 -105
- data/spec/fixtures/relative_path_package.json +0 -13
- data/spec/fixtures/relative_path_pnpm-lock.v7.yaml +0 -18
- data/spec/fixtures/relative_path_pnpm-lock.v8.yaml +0 -22
- data/spec/fixtures/relative_path_pnpm-lock.v9.yaml +0 -28
- data/spec/fixtures/relative_path_yarn.v1.lock +0 -104
- data/spec/fixtures/relative_path_yarn.v2.lock +0 -165
- data/spec/fixtures/semver_caret_package-lock.v1.json +0 -119
- data/spec/fixtures/semver_caret_package-lock.v2.json +0 -10264
- data/spec/fixtures/semver_caret_package.json +0 -13
- data/spec/fixtures/semver_caret_pnpm-lock.v7.yaml +0 -117
- data/spec/fixtures/semver_caret_pnpm-lock.v8.yaml +0 -2558
- data/spec/fixtures/semver_caret_pnpm-lock.v9.yaml +0 -4285
- data/spec/fixtures/semver_caret_yarn.v1.lock +0 -106
- data/spec/fixtures/semver_caret_yarn.v2.lock +0 -165
- data/spec/fixtures/semver_exact_package-lock.v1.json +0 -119
- data/spec/fixtures/semver_exact_package-lock.v2.json +0 -6819
- data/spec/fixtures/semver_exact_package.json +0 -13
- data/spec/fixtures/semver_exact_pnpm-lock.v7.yaml +0 -117
- data/spec/fixtures/semver_exact_pnpm-lock.v8.yaml +0 -2558
- data/spec/fixtures/semver_exact_pnpm-lock.v9.yaml +0 -2908
- data/spec/fixtures/semver_exact_yarn.v1.lock +0 -106
- data/spec/fixtures/semver_exact_yarn.v2.lock +0 -165
- data/spec/fixtures/semver_tilde_package-lock.v1.json +0 -119
- data/spec/fixtures/semver_tilde_package-lock.v2.json +0 -6777
- data/spec/fixtures/semver_tilde_package.json +0 -13
- data/spec/fixtures/semver_tilde_pnpm-lock.v7.yaml +0 -116
- data/spec/fixtures/semver_tilde_pnpm-lock.v8.yaml +0 -2558
- data/spec/fixtures/semver_tilde_pnpm-lock.v9.yaml +0 -2885
- data/spec/fixtures/semver_tilde_yarn.v1.lock +0 -106
- data/spec/fixtures/semver_tilde_yarn.v2.lock +0 -164
- data/spec/fixtures/without_package-lock.v1.json +0 -19
- data/spec/fixtures/without_package-lock.v2.json +0 -47
- data/spec/fixtures/without_package.json +0 -13
- data/spec/fixtures/without_pnpm-lock.v7.yaml +0 -23
- data/spec/fixtures/without_pnpm-lock.v8.yaml +0 -27
- data/spec/fixtures/without_pnpm-lock.v9.yaml +0 -34
- data/spec/fixtures/without_yarn.v1.lock +0 -13
- data/spec/fixtures/without_yarn.v2.lock +0 -29
- data/spec/generator_specs/e2e_template/files/app/controllers/home_controller.rb +0 -4
- data/spec/generator_specs/e2e_template/files/app/javascript/components/App.js +0 -12
- data/spec/generator_specs/e2e_template/files/app/javascript/packs/application.js +0 -10
- data/spec/generator_specs/e2e_template/files/app/views/home/index.html.erb +0 -2
- data/spec/generator_specs/e2e_template/files/app/views/layouts/application.html.erb +0 -17
- data/spec/generator_specs/e2e_template/files/config/routes.rb +0 -3
- data/spec/generator_specs/e2e_template/files/spec/system/test_react_component_renders_spec.rb +0 -13
- data/spec/generator_specs/e2e_template/template.rb +0 -29
- data/spec/generator_specs/fake-bin/bun +0 -10
- data/spec/generator_specs/fake-bin/npm +0 -10
- data/spec/generator_specs/fake-bin/pnpm +0 -10
- data/spec/generator_specs/fake-bin/yarn +0 -10
- data/spec/generator_specs/generator_spec.rb +0 -193
- data/spec/mounted_app/Rakefile +0 -4
- data/spec/mounted_app/package.json +0 -1
- data/spec/mounted_app/test/dummy/Rakefile +0 -3
- data/spec/mounted_app/test/dummy/bin/rails +0 -3
- data/spec/mounted_app/test/dummy/bin/rake +0 -3
- data/spec/mounted_app/test/dummy/config/application.rb +0 -10
- data/spec/mounted_app/test/dummy/config/environment.rb +0 -3
- data/spec/mounted_app/test/dummy/config/webpacker.yml +0 -81
- data/spec/mounted_app/test/dummy/config.ru +0 -5
- data/spec/mounted_app/test/dummy/package.json +0 -7
- data/spec/shakapacker/command_spec.rb +0 -134
- data/spec/shakapacker/compiler_spec.rb +0 -57
- data/spec/shakapacker/compiler_strategy_spec.rb +0 -24
- data/spec/shakapacker/configuration_spec.rb +0 -377
- data/spec/shakapacker/dev_server_runner_spec.rb +0 -136
- data/spec/shakapacker/dev_server_spec.rb +0 -118
- data/spec/shakapacker/digest_strategy_spec.rb +0 -59
- data/spec/shakapacker/engine_rake_tasks_spec.rb +0 -50
- data/spec/shakapacker/env_spec.rb +0 -23
- data/spec/shakapacker/helper_spec.rb +0 -243
- data/spec/shakapacker/instance_spec.rb +0 -29
- data/spec/shakapacker/manifest_spec.rb +0 -100
- data/spec/shakapacker/mtime_strategy_spec.rb +0 -55
- data/spec/shakapacker/rake_tasks_spec.rb +0 -85
- data/spec/shakapacker/shakapacker_spec.rb +0 -40
- data/spec/shakapacker/spec_helper_initializer.rb +0 -24
- data/spec/shakapacker/test_app/.gitignore +0 -2
- data/spec/shakapacker/test_app/Rakefile +0 -3
- data/spec/shakapacker/test_app/app/javascript/entrypoints/application.js +0 -10
- data/spec/shakapacker/test_app/app/javascript/entrypoints/generated/something.js +0 -2
- data/spec/shakapacker/test_app/app/javascript/entrypoints/multi_entry.css +0 -4
- data/spec/shakapacker/test_app/app/javascript/entrypoints/multi_entry.js +0 -4
- data/spec/shakapacker/test_app/bin/shakapacker +0 -14
- data/spec/shakapacker/test_app/bin/shakapacker-dev-server +0 -14
- data/spec/shakapacker/test_app/config/application.rb +0 -11
- data/spec/shakapacker/test_app/config/environment.rb +0 -4
- data/spec/shakapacker/test_app/config/initializers/inspect_autoload_paths.rb +0 -1
- data/spec/shakapacker/test_app/config/shakapacker.yml +0 -82
- data/spec/shakapacker/test_app/config/shakapacker_css_extract_ignore_order_warnings.yml +0 -83
- data/spec/shakapacker/test_app/config/shakapacker_defaults_fallback.yml +0 -11
- data/spec/shakapacker/test_app/config/shakapacker_manifest_path.yml +0 -79
- data/spec/shakapacker/test_app/config/shakapacker_nested_entries.yml +0 -82
- data/spec/shakapacker/test_app/config/shakapacker_no_precompile.yml +0 -7
- data/spec/shakapacker/test_app/config/shakapacker_other_location.yml +0 -84
- data/spec/shakapacker/test_app/config/shakapacker_public_root.yml +0 -18
- data/spec/shakapacker/test_app/config/webpack/webpack.config.js +0 -0
- data/spec/shakapacker/test_app/config.ru +0 -5
- data/spec/shakapacker/test_app/package.json +0 -14
- data/spec/shakapacker/test_app/public/packs/manifest.json +0 -58
- data/spec/shakapacker/test_app/some.config.js +0 -0
- data/spec/shakapacker/test_app/yarn.lock +0 -11
- data/spec/shakapacker/utils_manager_spec.rb +0 -125
- data/spec/shakapacker/version_checker_spec.rb +0 -1469
- data/spec/shakapacker/webpack_runner_spec.rb +0 -76
- data/spec/spec_helper.rb +0 -100
- data/spec/support/package_json_helpers.rb +0 -19
@@ -1,1469 +0,0 @@
|
|
1
|
-
require_relative "spec_helper_initializer"
|
2
|
-
require "shakapacker/version"
|
3
|
-
|
4
|
-
class NodePackageVersionDouble
|
5
|
-
attr_reader :raw, :major_minor_patch
|
6
|
-
|
7
|
-
def initialize(raw: nil, major_minor_patch: nil, semver_wildcard: false, skip_processing: false)
|
8
|
-
@raw = raw
|
9
|
-
@major_minor_patch = major_minor_patch
|
10
|
-
@semver_wildcard = semver_wildcard
|
11
|
-
@skip_processing = skip_processing
|
12
|
-
end
|
13
|
-
|
14
|
-
def semver_wildcard?
|
15
|
-
@semver_wildcard
|
16
|
-
end
|
17
|
-
|
18
|
-
def skip_processing?
|
19
|
-
@skip_processing
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "VersionChecker" do
|
24
|
-
def check_version(node_package_version, stub_gem_version = Shakapacker::VERSION, stub_config = true)
|
25
|
-
version_checker = Shakapacker::VersionChecker.new(node_package_version)
|
26
|
-
allow(version_checker).to receive(:gem_version).and_return(stub_gem_version)
|
27
|
-
allow(Shakapacker.config).to receive(:ensure_consistent_versioning?).and_return(stub_config)
|
28
|
-
|
29
|
-
version_checker.raise_if_gem_and_node_package_versions_differ
|
30
|
-
end
|
31
|
-
|
32
|
-
it "does nothing if consistency check is disabled and version mismatch" do
|
33
|
-
node_package_version = NodePackageVersionDouble.new(raw: "6.1.0", major_minor_patch: ["6", "1", "0"])
|
34
|
-
|
35
|
-
expect { check_version(node_package_version, "6.0.0", false) }
|
36
|
-
.not_to output
|
37
|
-
.to_stderr
|
38
|
-
end
|
39
|
-
|
40
|
-
it "does nothing if consistency check is disabled and we have semver" do
|
41
|
-
node_package_version = NodePackageVersionDouble.new(raw: "^6.1.0", major_minor_patch: ["6", "1", "0"], semver_wildcard: true)
|
42
|
-
|
43
|
-
expect { check_version(node_package_version, "6.0.0", false) }
|
44
|
-
.not_to output
|
45
|
-
.to_stderr
|
46
|
-
end
|
47
|
-
|
48
|
-
it "raises an exception on different major versions" do
|
49
|
-
node_package_version = NodePackageVersionDouble.new(raw: "6.1.0", major_minor_patch: ["6", "1", "0"])
|
50
|
-
|
51
|
-
expect { check_version(node_package_version, "7.0.0") }
|
52
|
-
.to raise_error(/\*\*ERROR\*\* Shakapacker: Shakapacker gem and node package versions do not match/)
|
53
|
-
end
|
54
|
-
|
55
|
-
it "raises an exception on different minor versions" do
|
56
|
-
node_package_version = NodePackageVersionDouble.new(raw: "6.1.0", major_minor_patch: ["6", "1", "0"])
|
57
|
-
|
58
|
-
expect { check_version(node_package_version, "6.2.0") }
|
59
|
-
.to raise_error(/\*\*ERROR\*\* Shakapacker: Shakapacker gem and node package versions do not match/)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "raises an exception on different patch versions" do
|
63
|
-
node_package_version = NodePackageVersionDouble.new(raw: "6.1.1", major_minor_patch: ["6", "1", "1"])
|
64
|
-
|
65
|
-
expect { check_version(node_package_version, "6.1.2") }
|
66
|
-
.to raise_error(/\*\*ERROR\*\* Shakapacker: Shakapacker gem and node package versions do not match/)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "raises an exception on a semver wildcard" do
|
70
|
-
node_package_version = NodePackageVersionDouble.new(raw: "^6.0.0", major_minor_patch: ["6", "0", "0"], semver_wildcard: true)
|
71
|
-
|
72
|
-
expect { check_version(node_package_version, "6.0.0") }
|
73
|
-
.to raise_error(/\*\*ERROR\*\* Shakapacker: Your node package version for shakapacker contains a \^ or ~/)
|
74
|
-
end
|
75
|
-
|
76
|
-
it "doesn't raise an exception on matching versions" do
|
77
|
-
node_package_version = NodePackageVersionDouble.new(raw: "6.0.0", major_minor_patch: ["6", "0", "0"])
|
78
|
-
|
79
|
-
expect { check_version(node_package_version, "6.0.0") }.to_not raise_error
|
80
|
-
end
|
81
|
-
|
82
|
-
it "doesn't raise an exception on matching beta versions" do
|
83
|
-
node_package_version = NodePackageVersionDouble.new(raw: "6.0.0-beta.1", major_minor_patch: ["6", "0", "0"])
|
84
|
-
|
85
|
-
expect { check_version(node_package_version, "6.0.0.beta.1") }.to_not raise_error
|
86
|
-
end
|
87
|
-
|
88
|
-
it "doesn't raise an exception on no package" do
|
89
|
-
node_package_version = NodePackageVersionDouble.new(raw: nil, skip_processing: true)
|
90
|
-
|
91
|
-
expect { check_version(node_package_version, "6.0.0") }.to_not raise_error
|
92
|
-
end
|
93
|
-
|
94
|
-
it "doesn't raise an exception on skipped paths" do
|
95
|
-
node_package_version = NodePackageVersionDouble.new(raw: "../..", skip_processing: true)
|
96
|
-
|
97
|
-
expect { check_version(node_package_version, "6.0.0") }.to_not raise_error
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
describe "VersionChecker::NodePackageVersion" do
|
102
|
-
context "with no lock file" do
|
103
|
-
def node_package_version(fixture_version:)
|
104
|
-
Shakapacker::VersionChecker::NodePackageVersion.new(
|
105
|
-
File.expand_path("../fixtures/#{fixture_version}_package.json", __dir__),
|
106
|
-
"file/does/not/exist",
|
107
|
-
"file/does/not/exist",
|
108
|
-
"file/does/not/exist"
|
109
|
-
)
|
110
|
-
end
|
111
|
-
|
112
|
-
context "when using an exact semantic version" do
|
113
|
-
let(:node_package_version_from_semver_exact) { node_package_version(fixture_version: "semver_exact") }
|
114
|
-
|
115
|
-
it "#raw returns the raw version" do
|
116
|
-
expect(node_package_version_from_semver_exact.raw).to eq "6.0.0"
|
117
|
-
end
|
118
|
-
|
119
|
-
it "#major_minor_patch returns an array" do
|
120
|
-
expect(node_package_version_from_semver_exact.major_minor_patch).to eq ["6", "0", "0"]
|
121
|
-
end
|
122
|
-
|
123
|
-
it "#skip_processing? returns false" do
|
124
|
-
expect(node_package_version_from_semver_exact.skip_processing?).to be false
|
125
|
-
end
|
126
|
-
|
127
|
-
it "#semver_wildcard returns false" do
|
128
|
-
expect(node_package_version_from_semver_exact.semver_wildcard?).to be false
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
context "when using a beta version" do
|
133
|
-
let(:node_package_version_from_beta) { node_package_version(fixture_version: "beta") }
|
134
|
-
|
135
|
-
it "#raw returns the raw version" do
|
136
|
-
expect(node_package_version_from_beta.raw).to eq "6.1.0-beta.0"
|
137
|
-
end
|
138
|
-
|
139
|
-
it "#major_minor_patch returns an array" do
|
140
|
-
expect(node_package_version_from_beta.major_minor_patch).to eq ["6", "1", "0"]
|
141
|
-
end
|
142
|
-
|
143
|
-
it "#skip_processing? returns false" do
|
144
|
-
expect(node_package_version_from_beta.skip_processing?).to be false
|
145
|
-
end
|
146
|
-
|
147
|
-
it "#semver_wildcard? returns false" do
|
148
|
-
expect(node_package_version_from_beta.semver_wildcard?).to be false
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
context "when using a caret constraint" do
|
153
|
-
let(:node_package_version_from_semver_caret) { node_package_version(fixture_version: "semver_caret") }
|
154
|
-
|
155
|
-
it "#raw returns the raw version" do
|
156
|
-
expect(node_package_version_from_semver_caret.raw).to eq "^6.0.0"
|
157
|
-
end
|
158
|
-
|
159
|
-
it "#major_minor_patch returns an array" do
|
160
|
-
expect(node_package_version_from_semver_caret.major_minor_patch).to eq ["6", "0", "0"]
|
161
|
-
end
|
162
|
-
|
163
|
-
it "#skip_processing? returns false" do
|
164
|
-
expect(node_package_version_from_semver_caret.skip_processing?).to be false
|
165
|
-
end
|
166
|
-
|
167
|
-
it "#semver_wildcard? returns true" do
|
168
|
-
expect(node_package_version_from_semver_caret.semver_wildcard?).to be true
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
context "when using a tilde constraint" do
|
173
|
-
let(:node_package_version_from_semver_tilde) { node_package_version(fixture_version: "semver_tilde") }
|
174
|
-
|
175
|
-
it "#raw returns the raw version" do
|
176
|
-
expect(node_package_version_from_semver_tilde.raw).to eq "~6.0.0"
|
177
|
-
end
|
178
|
-
|
179
|
-
it "#major_minor_patch returns version" do
|
180
|
-
expect(node_package_version_from_semver_tilde.major_minor_patch).to eq ["6", "0", "0"]
|
181
|
-
end
|
182
|
-
|
183
|
-
it "#skip_processing? returns false" do
|
184
|
-
expect(node_package_version_from_semver_tilde.skip_processing?).to be false
|
185
|
-
end
|
186
|
-
|
187
|
-
it "#semver_wildcard? returns true" do
|
188
|
-
expect(node_package_version_from_semver_tilde.semver_wildcard?).to be true
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
context "when using a relative path" do
|
193
|
-
let(:node_package_version_from_relative_path) { node_package_version(fixture_version: "relative_path") }
|
194
|
-
|
195
|
-
it "#raw returns the relative path" do
|
196
|
-
expect(node_package_version_from_relative_path.raw).to eq "../.."
|
197
|
-
end
|
198
|
-
|
199
|
-
it "#major_minor_patch returns nil" do
|
200
|
-
expect(node_package_version_from_relative_path.major_minor_patch).to be nil
|
201
|
-
end
|
202
|
-
|
203
|
-
it "#skip_processing? returns true" do
|
204
|
-
expect(node_package_version_from_relative_path.skip_processing?).to be true
|
205
|
-
end
|
206
|
-
|
207
|
-
it "#semver_wildcard? returns false" do
|
208
|
-
expect(node_package_version_from_relative_path.semver_wildcard?).to be false
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
context "when using a git url" do
|
213
|
-
let(:node_package_version_from_git_url) { node_package_version(fixture_version: "git_url") }
|
214
|
-
|
215
|
-
it "#raw returns the git url" do
|
216
|
-
expect(node_package_version_from_git_url.raw).to eq "git@github.com:shakacode/shakapacker.git"
|
217
|
-
end
|
218
|
-
|
219
|
-
it "#major_minor_patch returns nil" do
|
220
|
-
expect(node_package_version_from_git_url.major_minor_patch).to be nil
|
221
|
-
end
|
222
|
-
|
223
|
-
it "#skip_processing? returns true" do
|
224
|
-
expect(node_package_version_from_git_url.skip_processing?).to be true
|
225
|
-
end
|
226
|
-
|
227
|
-
it "#semver_wildcard? returns false" do
|
228
|
-
expect(node_package_version_from_git_url.semver_wildcard?).to be false
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
context "when using a github url" do
|
233
|
-
let(:node_package_version_from_github_url) { node_package_version(fixture_version: "github_url") }
|
234
|
-
|
235
|
-
it "#raw returns the GitHub repo address" do
|
236
|
-
expect(node_package_version_from_github_url.raw).to eq "shakacode/shakapacker#main"
|
237
|
-
end
|
238
|
-
|
239
|
-
it "#major_minor_patch returns nil" do
|
240
|
-
expect(node_package_version_from_github_url.major_minor_patch).to be nil
|
241
|
-
end
|
242
|
-
|
243
|
-
it "#skip_processing returns true" do
|
244
|
-
expect(node_package_version_from_github_url.skip_processing?).to be true
|
245
|
-
end
|
246
|
-
|
247
|
-
it "#semver_wildcard returns false" do
|
248
|
-
expect(node_package_version_from_github_url.semver_wildcard?).to be false
|
249
|
-
end
|
250
|
-
end
|
251
|
-
|
252
|
-
context "when shakapacker is not a dependency" do
|
253
|
-
let(:node_package_version_from_without) { node_package_version(fixture_version: "without") }
|
254
|
-
|
255
|
-
it "#raw returns an empty string" do
|
256
|
-
expect(node_package_version_from_without.raw).to eq ""
|
257
|
-
end
|
258
|
-
|
259
|
-
it "#major_minor_patch returns nil" do
|
260
|
-
expect(node_package_version_from_without.major_minor_patch).to be nil
|
261
|
-
end
|
262
|
-
|
263
|
-
it "#skip_processing? returns true" do
|
264
|
-
expect(node_package_version_from_without.skip_processing?).to be true
|
265
|
-
end
|
266
|
-
|
267
|
-
it "#semver_wildcard? returns false" do
|
268
|
-
expect(node_package_version_from_without.semver_wildcard?).to be false
|
269
|
-
end
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
context "with yarn.lock v1" do
|
274
|
-
def node_package_version(fixture_version:)
|
275
|
-
Shakapacker::VersionChecker::NodePackageVersion.new(
|
276
|
-
File.expand_path("../fixtures/#{fixture_version}_package.json", __dir__),
|
277
|
-
File.expand_path("../fixtures/#{fixture_version}_yarn.v1.lock", __dir__),
|
278
|
-
"file/does/not/exist",
|
279
|
-
"file/does/not/exist"
|
280
|
-
)
|
281
|
-
end
|
282
|
-
|
283
|
-
context "when using an exact semantic version" do
|
284
|
-
let(:node_package_version_from_semver_exact) { node_package_version(fixture_version: "semver_exact") }
|
285
|
-
|
286
|
-
it "#raw returns the raw version" do
|
287
|
-
expect(node_package_version_from_semver_exact.raw).to eq "6.0.0"
|
288
|
-
end
|
289
|
-
|
290
|
-
it "#major_minor_patch returns an array" do
|
291
|
-
expect(node_package_version_from_semver_exact.major_minor_patch).to eq ["6", "0", "0"]
|
292
|
-
end
|
293
|
-
|
294
|
-
it "#skip_processing? returns false" do
|
295
|
-
expect(node_package_version_from_semver_exact.skip_processing?).to be false
|
296
|
-
end
|
297
|
-
|
298
|
-
it "#semver_wildcard? returns false" do
|
299
|
-
expect(node_package_version_from_semver_exact.semver_wildcard?).to be false
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
context "when using a beta version" do
|
304
|
-
let(:node_package_version_from_beta) { node_package_version(fixture_version: "beta") }
|
305
|
-
|
306
|
-
it "#raw returns the raw version" do
|
307
|
-
expect(node_package_version_from_beta.raw).to eq "6.1.0-beta.0"
|
308
|
-
end
|
309
|
-
|
310
|
-
it "#major_minor_patch returns an array" do
|
311
|
-
expect(node_package_version_from_beta.major_minor_patch).to eq ["6", "1", "0"]
|
312
|
-
end
|
313
|
-
|
314
|
-
it "#skip_processing? returns false" do
|
315
|
-
expect(node_package_version_from_beta.skip_processing?).to be false
|
316
|
-
end
|
317
|
-
|
318
|
-
it "#semver_wildcard? returns false" do
|
319
|
-
expect(node_package_version_from_beta.semver_wildcard?).to be false
|
320
|
-
end
|
321
|
-
end
|
322
|
-
|
323
|
-
context "when using a caret constraint" do
|
324
|
-
let(:node_package_version_from_semver_caret) { node_package_version(fixture_version: "semver_caret") }
|
325
|
-
|
326
|
-
it "#raw returns the raw version" do
|
327
|
-
expect(node_package_version_from_semver_caret.raw).to eq "6.5.0"
|
328
|
-
end
|
329
|
-
|
330
|
-
it "#major_minor_patch returns an array" do
|
331
|
-
expect(node_package_version_from_semver_caret.major_minor_patch).to eq ["6", "5", "0"]
|
332
|
-
end
|
333
|
-
|
334
|
-
it "#skip_processing? false" do
|
335
|
-
expect(node_package_version_from_semver_caret.skip_processing?).to be false
|
336
|
-
end
|
337
|
-
|
338
|
-
it "#semver_wildcard? false" do
|
339
|
-
expect(node_package_version_from_semver_caret.semver_wildcard?).to be false
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
context "when using a tilde constraint" do
|
344
|
-
let(:node_package_version_from_semver_tilde) { node_package_version(fixture_version: "semver_tilde") }
|
345
|
-
|
346
|
-
it "#raw returns the raw version" do
|
347
|
-
expect(node_package_version_from_semver_tilde.raw).to eq "6.0.2"
|
348
|
-
end
|
349
|
-
|
350
|
-
it "#major_minor_patch returns an array" do
|
351
|
-
expect(node_package_version_from_semver_tilde.major_minor_patch).to eq ["6", "0", "2"]
|
352
|
-
end
|
353
|
-
|
354
|
-
it "#skip_processing? returns false" do
|
355
|
-
expect(node_package_version_from_semver_tilde.skip_processing?).to be false
|
356
|
-
end
|
357
|
-
|
358
|
-
it "#semver_wildcard? returns false" do
|
359
|
-
expect(node_package_version_from_semver_tilde.semver_wildcard?).to be false
|
360
|
-
end
|
361
|
-
end
|
362
|
-
|
363
|
-
context "when using a relative path" do
|
364
|
-
let(:node_package_version_from_relative_path) { node_package_version(fixture_version: "relative_path") }
|
365
|
-
|
366
|
-
it "#raw returns the raw version" do
|
367
|
-
expect(node_package_version_from_relative_path.raw).to eq "6.5.0"
|
368
|
-
end
|
369
|
-
|
370
|
-
it "#major_minor_patch returns an array" do
|
371
|
-
expect(node_package_version_from_relative_path.major_minor_patch).to eq ["6", "5", "0"]
|
372
|
-
end
|
373
|
-
|
374
|
-
it "#skip_processing? returns false" do
|
375
|
-
expect(node_package_version_from_relative_path.skip_processing?).to be false
|
376
|
-
end
|
377
|
-
|
378
|
-
it "#semver_wildcard? returns false" do
|
379
|
-
expect(node_package_version_from_relative_path.semver_wildcard?).to be false
|
380
|
-
end
|
381
|
-
end
|
382
|
-
|
383
|
-
context "when using a git url" do
|
384
|
-
let(:node_package_version_from_git_url) { node_package_version(fixture_version: "git_url") }
|
385
|
-
|
386
|
-
it "#raw returns the raw version" do
|
387
|
-
expect(node_package_version_from_git_url.raw).to eq "6.5.0"
|
388
|
-
end
|
389
|
-
|
390
|
-
it "#major_minor_patch returns an array" do
|
391
|
-
expect(node_package_version_from_git_url.major_minor_patch).to eq ["6", "5", "0"]
|
392
|
-
end
|
393
|
-
|
394
|
-
it "#skip_processing? returns false" do
|
395
|
-
expect(node_package_version_from_git_url.skip_processing?).to be false
|
396
|
-
end
|
397
|
-
|
398
|
-
it "#semver_wildcard? returns false" do
|
399
|
-
expect(node_package_version_from_git_url.semver_wildcard?).to be false
|
400
|
-
end
|
401
|
-
end
|
402
|
-
|
403
|
-
context "from GitHub url" do
|
404
|
-
let(:node_package_version_from_github_url) { node_package_version(fixture_version: "github_url") }
|
405
|
-
|
406
|
-
it "#raw returns the raw version" do
|
407
|
-
expect(node_package_version_from_github_url.raw).to eq "6.5.0"
|
408
|
-
end
|
409
|
-
|
410
|
-
it "#major_minor_patch returns an array" do
|
411
|
-
expect(node_package_version_from_github_url.major_minor_patch).to eq ["6", "5", "0"]
|
412
|
-
end
|
413
|
-
|
414
|
-
it "#skip_processing? returns false" do
|
415
|
-
expect(node_package_version_from_github_url.skip_processing?).to be false
|
416
|
-
end
|
417
|
-
|
418
|
-
it "#semver_wildcard? returns false" do
|
419
|
-
expect(node_package_version_from_github_url.semver_wildcard?).to be false
|
420
|
-
end
|
421
|
-
end
|
422
|
-
|
423
|
-
context "when shakapacker is not a dependency" do
|
424
|
-
let(:node_package_version_from_without) { node_package_version(fixture_version: "without") }
|
425
|
-
|
426
|
-
it "#raw returns an empty string" do
|
427
|
-
expect(node_package_version_from_without.raw).to eq ""
|
428
|
-
end
|
429
|
-
|
430
|
-
it "#major_minor_patch returns nil" do
|
431
|
-
expect(node_package_version_from_without.major_minor_patch).to be nil
|
432
|
-
end
|
433
|
-
|
434
|
-
it "#skip_processing? returns true" do
|
435
|
-
expect(node_package_version_from_without.skip_processing?).to be true
|
436
|
-
end
|
437
|
-
|
438
|
-
it "#semver_wildcard? returns false" do
|
439
|
-
expect(node_package_version_from_without.semver_wildcard?).to be false
|
440
|
-
end
|
441
|
-
end
|
442
|
-
end
|
443
|
-
|
444
|
-
context "with yarn.lock v2" do
|
445
|
-
def node_package_version(fixture_version:)
|
446
|
-
Shakapacker::VersionChecker::NodePackageVersion.new(
|
447
|
-
File.expand_path("../fixtures/#{fixture_version}_package.json", __dir__),
|
448
|
-
File.expand_path("../fixtures/#{fixture_version}_yarn.v2.lock", __dir__),
|
449
|
-
"file/does/not/exist",
|
450
|
-
"file/does/not/exist"
|
451
|
-
)
|
452
|
-
end
|
453
|
-
|
454
|
-
context "when using an exact semantic version" do
|
455
|
-
let(:node_package_version_from_semver_exact) { node_package_version(fixture_version: "semver_exact") }
|
456
|
-
|
457
|
-
it "#raw returns the raw version" do
|
458
|
-
expect(node_package_version_from_semver_exact.raw).to eq "6.0.0"
|
459
|
-
end
|
460
|
-
|
461
|
-
it "#major_minor_patch returns an array" do
|
462
|
-
expect(node_package_version_from_semver_exact.major_minor_patch).to eq ["6", "0", "0"]
|
463
|
-
end
|
464
|
-
|
465
|
-
it "#skip_processing? returns false" do
|
466
|
-
expect(node_package_version_from_semver_exact.skip_processing?).to be false
|
467
|
-
end
|
468
|
-
|
469
|
-
it "#semver_wildcard? returns false" do
|
470
|
-
expect(node_package_version_from_semver_exact.semver_wildcard?).to be false
|
471
|
-
end
|
472
|
-
end
|
473
|
-
|
474
|
-
context "when using a beta version" do
|
475
|
-
let(:node_package_version_from_beta) { node_package_version(fixture_version: "beta") }
|
476
|
-
|
477
|
-
it "#raw returns the raw version" do
|
478
|
-
expect(node_package_version_from_beta.raw).to eq "6.1.0-beta.0"
|
479
|
-
end
|
480
|
-
|
481
|
-
it "#major_minor_patch returns an array" do
|
482
|
-
expect(node_package_version_from_beta.major_minor_patch).to eq ["6", "1", "0"]
|
483
|
-
end
|
484
|
-
|
485
|
-
it "#skip_processing? returns false" do
|
486
|
-
expect(node_package_version_from_beta.skip_processing?).to be false
|
487
|
-
end
|
488
|
-
|
489
|
-
it "#semver_wildcard? returns false" do
|
490
|
-
expect(node_package_version_from_beta.semver_wildcard?).to be false
|
491
|
-
end
|
492
|
-
end
|
493
|
-
|
494
|
-
context "when using a caret constraint" do
|
495
|
-
let(:node_package_version_from_semver_caret) { node_package_version(fixture_version: "semver_caret") }
|
496
|
-
|
497
|
-
it "#raw returns the raw version" do
|
498
|
-
expect(node_package_version_from_semver_caret.raw).to eq "6.5.0"
|
499
|
-
end
|
500
|
-
|
501
|
-
it "#major_minor_patch returns an array" do
|
502
|
-
expect(node_package_version_from_semver_caret.major_minor_patch).to eq ["6", "5", "0"]
|
503
|
-
end
|
504
|
-
|
505
|
-
it "#skip_processing? returns false" do
|
506
|
-
expect(node_package_version_from_semver_caret.skip_processing?).to be false
|
507
|
-
end
|
508
|
-
|
509
|
-
it "#semver_wildcard? returns false" do
|
510
|
-
expect(node_package_version_from_semver_caret.semver_wildcard?).to be false
|
511
|
-
end
|
512
|
-
end
|
513
|
-
|
514
|
-
context "when using a tilde constraint" do
|
515
|
-
let(:node_package_version_from_semver_tilde) { node_package_version(fixture_version: "semver_tilde") }
|
516
|
-
|
517
|
-
it "#raw returns the raw version" do
|
518
|
-
expect(node_package_version_from_semver_tilde.raw).to eq "6.0.2"
|
519
|
-
end
|
520
|
-
|
521
|
-
it "#major_minor_patch returns an array" do
|
522
|
-
expect(node_package_version_from_semver_tilde.major_minor_patch).to eq ["6", "0", "2"]
|
523
|
-
end
|
524
|
-
|
525
|
-
it "#skip_processing? returns false" do
|
526
|
-
expect(node_package_version_from_semver_tilde.skip_processing?).to be false
|
527
|
-
end
|
528
|
-
|
529
|
-
it "#semver_wildcard? returns false" do
|
530
|
-
expect(node_package_version_from_semver_tilde.semver_wildcard?).to be false
|
531
|
-
end
|
532
|
-
end
|
533
|
-
|
534
|
-
context "when using a relative path" do
|
535
|
-
let(:node_package_version_from_relative_path) { node_package_version(fixture_version: "relative_path") }
|
536
|
-
|
537
|
-
it "#raw returns the raw version" do
|
538
|
-
expect(node_package_version_from_relative_path.raw).to eq "6.5.0"
|
539
|
-
end
|
540
|
-
|
541
|
-
it "#major_minor_patch returns an array" do
|
542
|
-
expect(node_package_version_from_relative_path.major_minor_patch).to eq ["6", "5", "0"]
|
543
|
-
end
|
544
|
-
|
545
|
-
it "#skip_processing? returns false" do
|
546
|
-
expect(node_package_version_from_relative_path.skip_processing?).to be false
|
547
|
-
end
|
548
|
-
|
549
|
-
it "#semver_wildcard? returns false" do
|
550
|
-
expect(node_package_version_from_relative_path.semver_wildcard?).to be false
|
551
|
-
end
|
552
|
-
end
|
553
|
-
|
554
|
-
context "when using a git url" do
|
555
|
-
let(:node_package_version_from_git_url) { node_package_version(fixture_version: "git_url") }
|
556
|
-
|
557
|
-
it "#raw returns the raw version" do
|
558
|
-
expect(node_package_version_from_git_url.raw).to eq "6.5.0"
|
559
|
-
end
|
560
|
-
|
561
|
-
it "#major_minor_patch returns an array" do
|
562
|
-
expect(node_package_version_from_git_url.major_minor_patch).to eq ["6", "5", "0"]
|
563
|
-
end
|
564
|
-
|
565
|
-
it "#skip_processing? returns false" do
|
566
|
-
expect(node_package_version_from_git_url.skip_processing?).to be false
|
567
|
-
end
|
568
|
-
|
569
|
-
it "#semver_wildcard? returns false" do
|
570
|
-
expect(node_package_version_from_git_url.semver_wildcard?).to be false
|
571
|
-
end
|
572
|
-
end
|
573
|
-
|
574
|
-
context "when using a github url" do
|
575
|
-
let(:node_package_version_from_github_url) { node_package_version(fixture_version: "github_url") }
|
576
|
-
|
577
|
-
it "#raw returns the raw version" do
|
578
|
-
expect(node_package_version_from_github_url.raw).to eq "6.5.0"
|
579
|
-
end
|
580
|
-
|
581
|
-
it "#major_minor_patch returns version array" do
|
582
|
-
expect(node_package_version_from_github_url.major_minor_patch).to eq ["6", "5", "0"]
|
583
|
-
end
|
584
|
-
|
585
|
-
it "#skip_processing? returns false" do
|
586
|
-
expect(node_package_version_from_github_url.skip_processing?).to be false
|
587
|
-
end
|
588
|
-
|
589
|
-
it "#semver_wildcard? returns false" do
|
590
|
-
expect(node_package_version_from_github_url.semver_wildcard?).to be false
|
591
|
-
end
|
592
|
-
end
|
593
|
-
|
594
|
-
context "when shakapacker is not a dependency" do
|
595
|
-
let(:node_package_version_from_without) { node_package_version(fixture_version: "without") }
|
596
|
-
|
597
|
-
it "#raw returns an empty string" do
|
598
|
-
expect(node_package_version_from_without.raw).to eq ""
|
599
|
-
end
|
600
|
-
|
601
|
-
it "#major_minor_patch returns nil" do
|
602
|
-
expect(node_package_version_from_without.major_minor_patch).to be nil
|
603
|
-
end
|
604
|
-
|
605
|
-
it "#skip_processing? returns true" do
|
606
|
-
expect(node_package_version_from_without.skip_processing?).to be true
|
607
|
-
end
|
608
|
-
|
609
|
-
it "#semver_wildcard? returns false" do
|
610
|
-
expect(node_package_version_from_without.semver_wildcard?).to be false
|
611
|
-
end
|
612
|
-
end
|
613
|
-
end
|
614
|
-
|
615
|
-
context "with package-lock.json v1" do
|
616
|
-
def node_package_version(fixture_version:)
|
617
|
-
Shakapacker::VersionChecker::NodePackageVersion.new(
|
618
|
-
File.expand_path("../fixtures/#{fixture_version}_package.json", __dir__),
|
619
|
-
"file/does/not/exist",
|
620
|
-
File.expand_path("../fixtures/#{fixture_version}_package-lock.v1.json", __dir__),
|
621
|
-
"file/does/not/exist"
|
622
|
-
)
|
623
|
-
end
|
624
|
-
|
625
|
-
context "when using an exact semantic version" do
|
626
|
-
let(:node_package_version_from_semver_exact) { node_package_version(fixture_version: "semver_exact") }
|
627
|
-
|
628
|
-
it "#raw returns the raw version" do
|
629
|
-
expect(node_package_version_from_semver_exact.raw).to eq "6.0.0"
|
630
|
-
end
|
631
|
-
|
632
|
-
it "#major_minor_patch returns an array" do
|
633
|
-
expect(node_package_version_from_semver_exact.major_minor_patch).to eq ["6", "0", "0"]
|
634
|
-
end
|
635
|
-
|
636
|
-
it "#skip_processing? returns false" do
|
637
|
-
expect(node_package_version_from_semver_exact.skip_processing?).to be false
|
638
|
-
end
|
639
|
-
|
640
|
-
it "#semver_wildcard? returns false" do
|
641
|
-
expect(node_package_version_from_semver_exact.semver_wildcard?).to be false
|
642
|
-
end
|
643
|
-
end
|
644
|
-
|
645
|
-
context "when using a beta version" do
|
646
|
-
let(:node_package_version_from_beta) { node_package_version(fixture_version: "beta") }
|
647
|
-
|
648
|
-
it "#raw returns the raw version" do
|
649
|
-
expect(node_package_version_from_beta.raw).to eq "6.1.0-beta.0"
|
650
|
-
end
|
651
|
-
|
652
|
-
it "#major_minor_patch returns an array" do
|
653
|
-
expect(node_package_version_from_beta.major_minor_patch).to eq ["6", "1", "0"]
|
654
|
-
end
|
655
|
-
|
656
|
-
it "#skip_processing? returns false" do
|
657
|
-
expect(node_package_version_from_beta.skip_processing?).to be false
|
658
|
-
end
|
659
|
-
|
660
|
-
it "#semver_wildcard? returns false" do
|
661
|
-
expect(node_package_version_from_beta.semver_wildcard?).to be false
|
662
|
-
end
|
663
|
-
end
|
664
|
-
|
665
|
-
context "when using a caret constraint" do
|
666
|
-
let(:node_package_version_from_semver_caret) { node_package_version(fixture_version: "semver_caret") }
|
667
|
-
|
668
|
-
it "#raw returns the raw version" do
|
669
|
-
expect(node_package_version_from_semver_caret.raw).to eq "6.5.0"
|
670
|
-
end
|
671
|
-
|
672
|
-
it "#major_minor_patch returns an array" do
|
673
|
-
expect(node_package_version_from_semver_caret.major_minor_patch).to eq ["6", "5", "0"]
|
674
|
-
end
|
675
|
-
|
676
|
-
it "#skip_processing? returns false" do
|
677
|
-
expect(node_package_version_from_semver_caret.skip_processing?).to be false
|
678
|
-
end
|
679
|
-
|
680
|
-
it "#semver_wildcard? returns false" do
|
681
|
-
expect(node_package_version_from_semver_caret.semver_wildcard?).to be false
|
682
|
-
end
|
683
|
-
end
|
684
|
-
|
685
|
-
context "when using a tilde constraint" do
|
686
|
-
let(:node_package_version_from_semver_tilde) { node_package_version(fixture_version: "semver_tilde") }
|
687
|
-
|
688
|
-
it "#raw returns the raw version" do
|
689
|
-
expect(node_package_version_from_semver_tilde.raw).to eq "6.0.2"
|
690
|
-
end
|
691
|
-
|
692
|
-
it "#major_minor_patch returns an array" do
|
693
|
-
expect(node_package_version_from_semver_tilde.major_minor_patch).to eq ["6", "0", "2"]
|
694
|
-
end
|
695
|
-
|
696
|
-
it "#skip_processing? returns false" do
|
697
|
-
expect(node_package_version_from_semver_tilde.skip_processing?).to be false
|
698
|
-
end
|
699
|
-
|
700
|
-
it "#semver_wildcard? returns false" do
|
701
|
-
expect(node_package_version_from_semver_tilde.semver_wildcard?).to be false
|
702
|
-
end
|
703
|
-
end
|
704
|
-
|
705
|
-
context "when using a relative path" do
|
706
|
-
let(:node_package_version_from_relative_path) { node_package_version(fixture_version: "relative_path") }
|
707
|
-
|
708
|
-
it "#raw returns the relative path" do
|
709
|
-
expect(node_package_version_from_relative_path.raw).to eq "file:../.."
|
710
|
-
end
|
711
|
-
|
712
|
-
it "#major_minor_patch returns nil" do
|
713
|
-
expect(node_package_version_from_relative_path.major_minor_patch).to be nil
|
714
|
-
end
|
715
|
-
|
716
|
-
it "#skip_processing? returns true" do
|
717
|
-
expect(node_package_version_from_relative_path.skip_processing?).to be true
|
718
|
-
end
|
719
|
-
|
720
|
-
it "#semver_wildcard? returns false" do
|
721
|
-
expect(node_package_version_from_relative_path.semver_wildcard?).to be false
|
722
|
-
end
|
723
|
-
end
|
724
|
-
|
725
|
-
context "when using a git url" do
|
726
|
-
let(:node_package_version_from_git_url) { node_package_version(fixture_version: "git_url") }
|
727
|
-
|
728
|
-
it "#raw returns the git url" do
|
729
|
-
expect(node_package_version_from_git_url.raw).to eq "git+ssh://git@github.com/shakacode/shakapacker.git#31854a58be49f736f3486a946b72d7e4f334e2b2"
|
730
|
-
end
|
731
|
-
|
732
|
-
it "#major_minor_patch returns nil" do
|
733
|
-
expect(node_package_version_from_git_url.major_minor_patch).to be nil
|
734
|
-
end
|
735
|
-
|
736
|
-
it "#skip_processing? returns true" do
|
737
|
-
expect(node_package_version_from_git_url.skip_processing?).to be true
|
738
|
-
end
|
739
|
-
|
740
|
-
it "#semver_wildcard? returns false" do
|
741
|
-
expect(node_package_version_from_git_url.semver_wildcard?).to be false
|
742
|
-
end
|
743
|
-
end
|
744
|
-
|
745
|
-
context "when using a github url" do
|
746
|
-
let(:node_package_version_from_github_url) { node_package_version(fixture_version: "github_url") }
|
747
|
-
|
748
|
-
it "#raw returns the GitHub repo address" do
|
749
|
-
expect(node_package_version_from_github_url.raw).to eq "github:shakacode/shakapacker#31854a58be49f736f3486a946b72d7e4f334e2b2"
|
750
|
-
end
|
751
|
-
|
752
|
-
it "#major_minor_patch returns nil" do
|
753
|
-
expect(node_package_version_from_github_url.major_minor_patch).to be nil
|
754
|
-
end
|
755
|
-
|
756
|
-
it "#skip_processing? returns true" do
|
757
|
-
expect(node_package_version_from_github_url.skip_processing?).to be true
|
758
|
-
end
|
759
|
-
|
760
|
-
it "#semver_wildcard? returns false" do
|
761
|
-
expect(node_package_version_from_github_url.semver_wildcard?).to be false
|
762
|
-
end
|
763
|
-
end
|
764
|
-
|
765
|
-
context "when shakapacker is not a dependency" do
|
766
|
-
let(:node_package_version_from_without) { node_package_version(fixture_version: "without") }
|
767
|
-
|
768
|
-
it "#raw returns an empty string" do
|
769
|
-
expect(node_package_version_from_without.raw).to eq ""
|
770
|
-
end
|
771
|
-
|
772
|
-
it "#major_minor_patch returns nil" do
|
773
|
-
expect(node_package_version_from_without.major_minor_patch).to be nil
|
774
|
-
end
|
775
|
-
|
776
|
-
it "#skip_processing? returns true" do
|
777
|
-
expect(node_package_version_from_without.skip_processing?).to be true
|
778
|
-
end
|
779
|
-
|
780
|
-
it "#semver_wildcard? returns false" do
|
781
|
-
expect(node_package_version_from_without.semver_wildcard?).to be false
|
782
|
-
end
|
783
|
-
end
|
784
|
-
end
|
785
|
-
|
786
|
-
context "with package-lock.json v2" do
|
787
|
-
def node_package_version(fixture_version:)
|
788
|
-
Shakapacker::VersionChecker::NodePackageVersion.new(
|
789
|
-
File.expand_path("../fixtures/#{fixture_version}_package.json", __dir__),
|
790
|
-
"file/does/not/exist",
|
791
|
-
File.expand_path("../fixtures/#{fixture_version}_package-lock.v2.json", __dir__),
|
792
|
-
"file/does/not/exist"
|
793
|
-
)
|
794
|
-
end
|
795
|
-
|
796
|
-
context "when using an exact semantic version" do
|
797
|
-
let(:node_package_version_from_semver_exact) { node_package_version(fixture_version: "semver_exact") }
|
798
|
-
|
799
|
-
it "#raw returns the raw version" do
|
800
|
-
expect(node_package_version_from_semver_exact.raw).to eq "6.0.0"
|
801
|
-
end
|
802
|
-
|
803
|
-
it "#major_minor_patch returns an array" do
|
804
|
-
expect(node_package_version_from_semver_exact.major_minor_patch).to eq ["6", "0", "0"]
|
805
|
-
end
|
806
|
-
|
807
|
-
it "#skip_processing? returns false" do
|
808
|
-
expect(node_package_version_from_semver_exact.skip_processing?).to be false
|
809
|
-
end
|
810
|
-
|
811
|
-
it "#semver_wildcard? returns false" do
|
812
|
-
expect(node_package_version_from_semver_exact.semver_wildcard?).to be false
|
813
|
-
end
|
814
|
-
end
|
815
|
-
|
816
|
-
context "when using a beta version" do
|
817
|
-
let(:node_package_version_from_beta) { node_package_version(fixture_version: "beta") }
|
818
|
-
|
819
|
-
it "#raw returns the raw version" do
|
820
|
-
expect(node_package_version_from_beta.raw).to eq "6.1.0-beta.0"
|
821
|
-
end
|
822
|
-
|
823
|
-
it "#major_minor_patch returns an array" do
|
824
|
-
expect(node_package_version_from_beta.major_minor_patch).to eq ["6", "1", "0"]
|
825
|
-
end
|
826
|
-
|
827
|
-
it "#skip_processing? returns false" do
|
828
|
-
expect(node_package_version_from_beta.skip_processing?).to be false
|
829
|
-
end
|
830
|
-
|
831
|
-
it "#semver_wildcard? returns false" do
|
832
|
-
expect(node_package_version_from_beta.semver_wildcard?).to be false
|
833
|
-
end
|
834
|
-
end
|
835
|
-
|
836
|
-
context "when using a caret constraint" do
|
837
|
-
let(:node_package_version_from_semver_caret) { node_package_version(fixture_version: "semver_caret") }
|
838
|
-
|
839
|
-
it "#raw returns the raw version" do
|
840
|
-
expect(node_package_version(fixture_version: "semver_caret").raw).to eq "6.5.0"
|
841
|
-
end
|
842
|
-
|
843
|
-
it "#major_minor_patch returns an array" do
|
844
|
-
expect(node_package_version(fixture_version: "semver_caret").major_minor_patch).to eq ["6", "5", "0"]
|
845
|
-
end
|
846
|
-
|
847
|
-
it "#skip_processing? returns false" do
|
848
|
-
expect(node_package_version(fixture_version: "semver_caret").skip_processing?).to be false
|
849
|
-
end
|
850
|
-
|
851
|
-
it "#semver_wildcard? returns false" do
|
852
|
-
expect(node_package_version(fixture_version: "semver_caret").semver_wildcard?).to be false
|
853
|
-
end
|
854
|
-
end
|
855
|
-
|
856
|
-
context "when using a tilde constraint" do
|
857
|
-
let(:node_package_version_from_semver_tilde) { node_package_version(fixture_version: "semver_tilde") }
|
858
|
-
|
859
|
-
it "#raw returns the raw version" do
|
860
|
-
expect(node_package_version_from_semver_tilde.raw).to eq "6.0.2"
|
861
|
-
end
|
862
|
-
|
863
|
-
it "#major_minor_patch returns an array" do
|
864
|
-
expect(node_package_version_from_semver_tilde.major_minor_patch).to eq ["6", "0", "2"]
|
865
|
-
end
|
866
|
-
|
867
|
-
it "#skip_processing? returns false" do
|
868
|
-
expect(node_package_version_from_semver_tilde.skip_processing?).to be false
|
869
|
-
end
|
870
|
-
|
871
|
-
it "#semver_wildcard? returns false" do
|
872
|
-
expect(node_package_version_from_semver_tilde.semver_wildcard?).to be false
|
873
|
-
end
|
874
|
-
end
|
875
|
-
|
876
|
-
context "when using a relative path" do
|
877
|
-
let(:node_package_version_from_relative_path) { node_package_version(fixture_version: "relative_path") }
|
878
|
-
|
879
|
-
it "#raw returns the relative path" do
|
880
|
-
expect(node_package_version_from_relative_path.raw).to eq "../.."
|
881
|
-
end
|
882
|
-
|
883
|
-
it "#major_minor_patch returns nil" do
|
884
|
-
expect(node_package_version_from_relative_path.major_minor_patch).to be nil
|
885
|
-
end
|
886
|
-
|
887
|
-
it "#skip_processing? returns true" do
|
888
|
-
expect(node_package_version_from_relative_path.skip_processing?).to be true
|
889
|
-
end
|
890
|
-
|
891
|
-
it "#semver_wildcard? returns false" do
|
892
|
-
expect(node_package_version_from_relative_path.semver_wildcard?).to be false
|
893
|
-
end
|
894
|
-
end
|
895
|
-
|
896
|
-
context "when using a git url" do
|
897
|
-
let(:node_package_version_from_git_url) { node_package_version(fixture_version: "git_url") }
|
898
|
-
|
899
|
-
it "#raw returns the raw version" do
|
900
|
-
expect(node_package_version_from_git_url.raw).to eq "6.5.0"
|
901
|
-
end
|
902
|
-
|
903
|
-
it "#major_minor_patch returns an array" do
|
904
|
-
expect(node_package_version_from_git_url.major_minor_patch).to eq ["6", "5", "0"]
|
905
|
-
end
|
906
|
-
|
907
|
-
it "#skip_processing? returns false" do
|
908
|
-
expect(node_package_version_from_git_url.skip_processing?).to be false
|
909
|
-
end
|
910
|
-
|
911
|
-
it "#semver_wildcard? returns false" do
|
912
|
-
expect(node_package_version_from_git_url.semver_wildcard?).to be false
|
913
|
-
end
|
914
|
-
end
|
915
|
-
|
916
|
-
context "when using a github url" do
|
917
|
-
let(:node_package_version_from_github_url) { node_package_version(fixture_version: "github_url") }
|
918
|
-
|
919
|
-
it "#raw returns the raw version" do
|
920
|
-
expect(node_package_version_from_github_url.raw).to eq "6.5.0"
|
921
|
-
end
|
922
|
-
|
923
|
-
it "#major_minor_patch returns an array" do
|
924
|
-
expect(node_package_version_from_github_url.major_minor_patch).to eq ["6", "5", "0"]
|
925
|
-
end
|
926
|
-
|
927
|
-
it "#skip_processing? returns false" do
|
928
|
-
expect(node_package_version_from_github_url.skip_processing?).to be false
|
929
|
-
end
|
930
|
-
|
931
|
-
it "#semver_wildcard? returns false" do
|
932
|
-
expect(node_package_version_from_github_url.semver_wildcard?).to be false
|
933
|
-
end
|
934
|
-
end
|
935
|
-
|
936
|
-
context "when shakapacker is not a dependency" do
|
937
|
-
let(:node_package_version_from_without) { node_package_version(fixture_version: "without") }
|
938
|
-
|
939
|
-
it "#raw returns an empty string" do
|
940
|
-
expect(node_package_version_from_without.raw).to eq ""
|
941
|
-
end
|
942
|
-
|
943
|
-
it "#major_minor_patch returns nil" do
|
944
|
-
expect(node_package_version_from_without.major_minor_patch).to be nil
|
945
|
-
end
|
946
|
-
|
947
|
-
it "#skip_processing? returns true" do
|
948
|
-
expect(node_package_version_from_without.skip_processing?).to be true
|
949
|
-
end
|
950
|
-
|
951
|
-
it "#semver_wildcard? returns false" do
|
952
|
-
expect(node_package_version_from_without.semver_wildcard?).to be false
|
953
|
-
end
|
954
|
-
end
|
955
|
-
end
|
956
|
-
|
957
|
-
context "with pnpm-lock.yaml v7" do
|
958
|
-
def node_package_version(fixture_version:)
|
959
|
-
Shakapacker::VersionChecker::NodePackageVersion.new(
|
960
|
-
File.expand_path("../fixtures/#{fixture_version}_package.json", __dir__),
|
961
|
-
"file/does/not/exist",
|
962
|
-
"file/does/not/exist",
|
963
|
-
File.expand_path("../fixtures/#{fixture_version}_pnpm-lock.v7.yaml", __dir__)
|
964
|
-
)
|
965
|
-
end
|
966
|
-
|
967
|
-
context "when using an exact semantic version" do
|
968
|
-
let(:node_package_version_from_semver_exact) { node_package_version(fixture_version: "semver_exact") }
|
969
|
-
|
970
|
-
it "#raw returns version" do
|
971
|
-
expect(node_package_version_from_semver_exact.raw).to eq "6.0.0"
|
972
|
-
end
|
973
|
-
|
974
|
-
it "#major_minor_patch returns an array" do
|
975
|
-
expect(node_package_version_from_semver_exact.major_minor_patch).to eq ["6", "0", "0"]
|
976
|
-
end
|
977
|
-
|
978
|
-
it "#skip_processing? returns false" do
|
979
|
-
expect(node_package_version_from_semver_exact.skip_processing?).to be false
|
980
|
-
end
|
981
|
-
|
982
|
-
it "#semver_wildcard? returns false" do
|
983
|
-
expect(node_package_version_from_semver_exact.semver_wildcard?).to be false
|
984
|
-
end
|
985
|
-
end
|
986
|
-
|
987
|
-
context "when using a beta version" do
|
988
|
-
let(:node_package_version_from_beta) { node_package_version(fixture_version: "beta") }
|
989
|
-
|
990
|
-
it "#raw returns the raw version" do
|
991
|
-
expect(node_package_version_from_beta.raw).to eq "6.1.0-beta.0"
|
992
|
-
end
|
993
|
-
|
994
|
-
it "#major_minor_patch returns an array" do
|
995
|
-
expect(node_package_version_from_beta.major_minor_patch).to eq ["6", "1", "0"]
|
996
|
-
end
|
997
|
-
|
998
|
-
it "#skip_processing? returns false" do
|
999
|
-
expect(node_package_version_from_beta.skip_processing?).to be false
|
1000
|
-
end
|
1001
|
-
|
1002
|
-
it "#semver_wildcard? returns false" do
|
1003
|
-
expect(node_package_version_from_beta.semver_wildcard?).to be false
|
1004
|
-
end
|
1005
|
-
end
|
1006
|
-
|
1007
|
-
context "when using a caret constraint" do
|
1008
|
-
let(:node_package_version_from_semver_caret) { node_package_version(fixture_version: "semver_caret") }
|
1009
|
-
|
1010
|
-
it "#raw returns the raw version" do
|
1011
|
-
expect(node_package_version_from_semver_caret.raw).to eq "6.6.0"
|
1012
|
-
end
|
1013
|
-
|
1014
|
-
it "#major_minor_patch returns an array" do
|
1015
|
-
expect(node_package_version_from_semver_caret.major_minor_patch).to eq ["6", "6", "0"]
|
1016
|
-
end
|
1017
|
-
|
1018
|
-
it "#skip_processing? returns false" do
|
1019
|
-
expect(node_package_version_from_semver_caret.skip_processing?).to be false
|
1020
|
-
end
|
1021
|
-
|
1022
|
-
it "#semver_wildcard? returns false" do
|
1023
|
-
expect(node_package_version_from_semver_caret.semver_wildcard?).to be false
|
1024
|
-
end
|
1025
|
-
end
|
1026
|
-
|
1027
|
-
context "when using a tilde constraint" do
|
1028
|
-
let(:node_package_version_from_semver_tilde) { node_package_version(fixture_version: "semver_tilde") }
|
1029
|
-
|
1030
|
-
it "#raw returns the raw version" do
|
1031
|
-
expect(node_package_version_from_semver_tilde.raw).to eq "6.0.2"
|
1032
|
-
end
|
1033
|
-
|
1034
|
-
it "#major_minor_patch returns an array" do
|
1035
|
-
expect(node_package_version_from_semver_tilde.major_minor_patch).to eq ["6", "0", "2"]
|
1036
|
-
end
|
1037
|
-
|
1038
|
-
it "#skip_processing? returns false" do
|
1039
|
-
expect(node_package_version_from_semver_tilde.skip_processing?).to be false
|
1040
|
-
end
|
1041
|
-
|
1042
|
-
it "#semver_wildcard? returns false" do
|
1043
|
-
expect(node_package_version_from_semver_tilde.semver_wildcard?).to be false
|
1044
|
-
end
|
1045
|
-
end
|
1046
|
-
|
1047
|
-
context "when using a relative path" do
|
1048
|
-
let(:node_package_version_from_relative_path) { node_package_version(fixture_version: "relative_path") }
|
1049
|
-
|
1050
|
-
it "#raw returns the raw version" do
|
1051
|
-
expect(node_package_version_from_relative_path.raw).to eq "../.."
|
1052
|
-
end
|
1053
|
-
|
1054
|
-
it "#major_minor_patch returns nil" do
|
1055
|
-
expect(node_package_version_from_relative_path.major_minor_patch).to be nil
|
1056
|
-
end
|
1057
|
-
|
1058
|
-
it "#skip_processing? returns true" do
|
1059
|
-
expect(node_package_version_from_relative_path.skip_processing?).to be true
|
1060
|
-
end
|
1061
|
-
|
1062
|
-
it "#semver_wildcard? returns false" do
|
1063
|
-
expect(node_package_version_from_relative_path.semver_wildcard?).to be false
|
1064
|
-
end
|
1065
|
-
end
|
1066
|
-
|
1067
|
-
context "when using a git url" do
|
1068
|
-
let(:node_package_version_from_git_url) { node_package_version(fixture_version: "git_url") }
|
1069
|
-
|
1070
|
-
it "#raw returns the raw version" do
|
1071
|
-
expect(node_package_version_from_git_url.raw).to eq "7.0.2"
|
1072
|
-
end
|
1073
|
-
|
1074
|
-
it "#major_minor_patch returns an array" do
|
1075
|
-
expect(node_package_version_from_git_url.major_minor_patch).to eq ["7", "0", "2"]
|
1076
|
-
end
|
1077
|
-
|
1078
|
-
it "#skip_processing? returns false" do
|
1079
|
-
expect(node_package_version_from_git_url.skip_processing?).to be false
|
1080
|
-
end
|
1081
|
-
|
1082
|
-
it "#semver_wildcard? returns false" do
|
1083
|
-
expect(node_package_version_from_git_url.semver_wildcard?).to be false
|
1084
|
-
end
|
1085
|
-
end
|
1086
|
-
|
1087
|
-
context "when using a github url" do
|
1088
|
-
let(:node_package_version_from_github_url) { node_package_version(fixture_version: "github_url") }
|
1089
|
-
|
1090
|
-
it "#raw returns the raw version" do
|
1091
|
-
expect(node_package_version_from_github_url.raw).to eq "7.0.2"
|
1092
|
-
end
|
1093
|
-
|
1094
|
-
it "#major_minor_patch returns version array" do
|
1095
|
-
expect(node_package_version_from_github_url.major_minor_patch).to eq ["7", "0", "2"]
|
1096
|
-
end
|
1097
|
-
|
1098
|
-
it "#skip_processing? returns false" do
|
1099
|
-
expect(node_package_version_from_github_url.skip_processing?).to be false
|
1100
|
-
end
|
1101
|
-
|
1102
|
-
it "#semver_wildcard? returns false" do
|
1103
|
-
expect(node_package_version_from_github_url.semver_wildcard?).to be false
|
1104
|
-
end
|
1105
|
-
end
|
1106
|
-
|
1107
|
-
context "when shakapacker is not a dependency" do
|
1108
|
-
let(:node_package_version_from_without) { node_package_version(fixture_version: "without") }
|
1109
|
-
|
1110
|
-
it "#raw returns an empty string" do
|
1111
|
-
expect(node_package_version_from_without.raw).to eq ""
|
1112
|
-
end
|
1113
|
-
|
1114
|
-
it "#major_minor_patch returns nil" do
|
1115
|
-
expect(node_package_version_from_without.major_minor_patch).to be nil
|
1116
|
-
end
|
1117
|
-
|
1118
|
-
it "#skip_processing? returns true" do
|
1119
|
-
expect(node_package_version_from_without.skip_processing?).to be true
|
1120
|
-
end
|
1121
|
-
|
1122
|
-
it "#semver_wildcard? returns false" do
|
1123
|
-
expect(node_package_version_from_without.semver_wildcard?).to be false
|
1124
|
-
end
|
1125
|
-
end
|
1126
|
-
end
|
1127
|
-
|
1128
|
-
context "with pnpm-lock.yaml v8" do
|
1129
|
-
def node_package_version(fixture_version:)
|
1130
|
-
Shakapacker::VersionChecker::NodePackageVersion.new(
|
1131
|
-
File.expand_path("../fixtures/#{fixture_version}_package.json", __dir__),
|
1132
|
-
"file/does/not/exist",
|
1133
|
-
"file/does/not/exist",
|
1134
|
-
File.expand_path("../fixtures/#{fixture_version}_pnpm-lock.v8.yaml", __dir__)
|
1135
|
-
)
|
1136
|
-
end
|
1137
|
-
|
1138
|
-
context "when using an exact semantic version" do
|
1139
|
-
let(:node_package_version_from_semver_exact) { node_package_version(fixture_version: "semver_exact") }
|
1140
|
-
|
1141
|
-
it "#raw returns the raw version" do
|
1142
|
-
expect(node_package_version_from_semver_exact.raw).to eq "6.0.0"
|
1143
|
-
end
|
1144
|
-
|
1145
|
-
it "#major_minor_patch returns an array" do
|
1146
|
-
expect(node_package_version_from_semver_exact.major_minor_patch).to eq ["6", "0", "0"]
|
1147
|
-
end
|
1148
|
-
|
1149
|
-
it "#skip_processing? returns false" do
|
1150
|
-
expect(node_package_version_from_semver_exact.skip_processing?).to be false
|
1151
|
-
end
|
1152
|
-
|
1153
|
-
it "#semver_wildcard? returns false" do
|
1154
|
-
expect(node_package_version_from_semver_exact.semver_wildcard?).to be false
|
1155
|
-
end
|
1156
|
-
end
|
1157
|
-
|
1158
|
-
context "when using a beta version" do
|
1159
|
-
let(:node_package_version_from_beta) { node_package_version(fixture_version: "beta") }
|
1160
|
-
|
1161
|
-
it "#raw returns the raw version" do
|
1162
|
-
expect(node_package_version_from_beta.raw).to eq "6.1.0-beta.0"
|
1163
|
-
end
|
1164
|
-
|
1165
|
-
it "#major_minor_patch returns an array" do
|
1166
|
-
expect(node_package_version_from_beta.major_minor_patch).to eq ["6", "1", "0"]
|
1167
|
-
end
|
1168
|
-
|
1169
|
-
it "#skip_processing? returns false" do
|
1170
|
-
expect(node_package_version_from_beta.skip_processing?).to be false
|
1171
|
-
end
|
1172
|
-
|
1173
|
-
it "#semver_wildcard? returns false" do
|
1174
|
-
expect(node_package_version_from_beta.semver_wildcard?).to be false
|
1175
|
-
end
|
1176
|
-
end
|
1177
|
-
|
1178
|
-
context "when using a caret constraint" do
|
1179
|
-
let(:node_package_version_from_semver_caret) { node_package_version(fixture_version: "semver_caret") }
|
1180
|
-
|
1181
|
-
it "#raw returns the raw version" do
|
1182
|
-
expect(node_package_version_from_semver_caret.raw).to eq "6.0.0"
|
1183
|
-
end
|
1184
|
-
|
1185
|
-
it "#major_minor_patch returns an array" do
|
1186
|
-
expect(node_package_version_from_semver_caret.major_minor_patch).to eq ["6", "0", "0"]
|
1187
|
-
end
|
1188
|
-
|
1189
|
-
it "#skip_processing? returns false" do
|
1190
|
-
expect(node_package_version_from_semver_caret.skip_processing?).to be false
|
1191
|
-
end
|
1192
|
-
|
1193
|
-
it "#semver_wildcard? returns false" do
|
1194
|
-
expect(node_package_version_from_semver_caret.semver_wildcard?).to be false
|
1195
|
-
end
|
1196
|
-
end
|
1197
|
-
|
1198
|
-
context "when using a tilde constraint" do
|
1199
|
-
let(:node_package_version_from_semver_tilde) { node_package_version(fixture_version: "semver_tilde") }
|
1200
|
-
|
1201
|
-
it "#raw returns the raw version" do
|
1202
|
-
expect(node_package_version_from_semver_tilde.raw).to eq "6.0.0"
|
1203
|
-
end
|
1204
|
-
|
1205
|
-
it "#major_minor_patch returns an array" do
|
1206
|
-
expect(node_package_version_from_semver_tilde.major_minor_patch).to eq ["6", "0", "0"]
|
1207
|
-
end
|
1208
|
-
|
1209
|
-
it "#skip_processing? returns false" do
|
1210
|
-
expect(node_package_version_from_semver_tilde.skip_processing?).to be false
|
1211
|
-
end
|
1212
|
-
|
1213
|
-
it "#semver_wildcard? returns false" do
|
1214
|
-
expect(node_package_version_from_semver_tilde.semver_wildcard?).to be false
|
1215
|
-
end
|
1216
|
-
end
|
1217
|
-
|
1218
|
-
context "when using a relative path" do
|
1219
|
-
let(:node_package_version_from_relative_path) { node_package_version(fixture_version: "relative_path") }
|
1220
|
-
|
1221
|
-
it "#raw returns the raw version" do
|
1222
|
-
expect(node_package_version_from_relative_path.raw).to eq "../.."
|
1223
|
-
end
|
1224
|
-
|
1225
|
-
it "#major_minor_patch returns nil" do
|
1226
|
-
expect(node_package_version_from_relative_path.major_minor_patch).to be nil
|
1227
|
-
end
|
1228
|
-
|
1229
|
-
it "#skip_processing? returns true" do
|
1230
|
-
expect(node_package_version_from_relative_path.skip_processing?).to be true
|
1231
|
-
end
|
1232
|
-
|
1233
|
-
it "#semver_wildcard? returns false" do
|
1234
|
-
expect(node_package_version_from_relative_path.semver_wildcard?).to be false
|
1235
|
-
end
|
1236
|
-
end
|
1237
|
-
|
1238
|
-
context "when using a git url" do
|
1239
|
-
let(:node_package_version_from_git_url) { node_package_version(fixture_version: "git_url") }
|
1240
|
-
|
1241
|
-
it "#raw returns the raw version" do
|
1242
|
-
expect(node_package_version_from_git_url.raw).to eq "7.0.2"
|
1243
|
-
end
|
1244
|
-
|
1245
|
-
it "#major_minor_patch returns an array" do
|
1246
|
-
expect(node_package_version_from_git_url.major_minor_patch).to eq ["7", "0", "2"]
|
1247
|
-
end
|
1248
|
-
|
1249
|
-
it "#skip_processing? returns false" do
|
1250
|
-
expect(node_package_version_from_git_url.skip_processing?).to be false
|
1251
|
-
end
|
1252
|
-
|
1253
|
-
it "#semver_wildcard? returns false" do
|
1254
|
-
expect(node_package_version_from_git_url.semver_wildcard?).to be false
|
1255
|
-
end
|
1256
|
-
end
|
1257
|
-
|
1258
|
-
context "when using a github url" do
|
1259
|
-
let(:node_package_version_from_github_url) { node_package_version(fixture_version: "github_url") }
|
1260
|
-
|
1261
|
-
it "#raw returns the raw version" do
|
1262
|
-
expect(node_package_version_from_github_url.raw).to eq "7.0.2"
|
1263
|
-
end
|
1264
|
-
|
1265
|
-
it "#major_minor_patch returns an array" do
|
1266
|
-
expect(node_package_version_from_github_url.major_minor_patch).to eq ["7", "0", "2"]
|
1267
|
-
end
|
1268
|
-
|
1269
|
-
it "#skip_processing? returns false" do
|
1270
|
-
expect(node_package_version_from_github_url.skip_processing?).to be false
|
1271
|
-
end
|
1272
|
-
|
1273
|
-
it "#semver_wildcard? returns false" do
|
1274
|
-
expect(node_package_version_from_github_url.semver_wildcard?).to be false
|
1275
|
-
end
|
1276
|
-
end
|
1277
|
-
|
1278
|
-
context "when shakapacker is not a dependency" do
|
1279
|
-
let(:node_package_version_from_without) { node_package_version(fixture_version: "without") }
|
1280
|
-
|
1281
|
-
it "#raw returns an empty string" do
|
1282
|
-
expect(node_package_version_from_without.raw).to eq ""
|
1283
|
-
end
|
1284
|
-
|
1285
|
-
it "#major_minor_patch returns nil" do
|
1286
|
-
expect(node_package_version_from_without.major_minor_patch).to be nil
|
1287
|
-
end
|
1288
|
-
|
1289
|
-
it "#skip_processing? returns true" do
|
1290
|
-
expect(node_package_version_from_without.skip_processing?).to be true
|
1291
|
-
end
|
1292
|
-
|
1293
|
-
it "#semver_wildcard? returns false" do
|
1294
|
-
expect(node_package_version_from_without.semver_wildcard?).to be false
|
1295
|
-
end
|
1296
|
-
end
|
1297
|
-
end
|
1298
|
-
|
1299
|
-
context "with pnpm-lock.yaml v9" do
|
1300
|
-
def node_package_version(fixture_version:)
|
1301
|
-
Shakapacker::VersionChecker::NodePackageVersion.new(
|
1302
|
-
File.expand_path("../fixtures/#{fixture_version}_package.json", __dir__),
|
1303
|
-
"file/does/not/exist",
|
1304
|
-
"file/does/not/exist",
|
1305
|
-
File.expand_path("../fixtures/#{fixture_version}_pnpm-lock.v9.yaml", __dir__)
|
1306
|
-
)
|
1307
|
-
end
|
1308
|
-
|
1309
|
-
context "when using an exact semantic version" do
|
1310
|
-
let(:node_package_version_from_semver_exact) { node_package_version(fixture_version: "semver_exact") }
|
1311
|
-
|
1312
|
-
it "#raw returns the raw version" do
|
1313
|
-
expect(node_package_version_from_semver_exact.raw).to eq "6.0.0"
|
1314
|
-
end
|
1315
|
-
|
1316
|
-
it "#major_minor_patch returns an array" do
|
1317
|
-
expect(node_package_version_from_semver_exact.major_minor_patch).to eq ["6", "0", "0"]
|
1318
|
-
end
|
1319
|
-
|
1320
|
-
it "#skip_processing? returns false" do
|
1321
|
-
expect(node_package_version_from_semver_exact.skip_processing?).to be false
|
1322
|
-
end
|
1323
|
-
|
1324
|
-
it "#semver_wildcard? returns false" do
|
1325
|
-
expect(node_package_version_from_semver_exact.semver_wildcard?).to be false
|
1326
|
-
end
|
1327
|
-
end
|
1328
|
-
|
1329
|
-
context "when using a beta version" do
|
1330
|
-
let(:node_package_version_from_beta) { node_package_version(fixture_version: "beta") }
|
1331
|
-
|
1332
|
-
it "#raw returns the raw version" do
|
1333
|
-
expect(node_package_version_from_beta.raw).to eq "6.1.0-beta.0"
|
1334
|
-
end
|
1335
|
-
|
1336
|
-
it "#major_minor_patch returns an array" do
|
1337
|
-
expect(node_package_version_from_beta.major_minor_patch).to eq ["6", "1", "0"]
|
1338
|
-
end
|
1339
|
-
|
1340
|
-
it "#skip_processing? returns false" do
|
1341
|
-
expect(node_package_version_from_beta.skip_processing?).to be false
|
1342
|
-
end
|
1343
|
-
|
1344
|
-
it "#semver_wildcard? returns false" do
|
1345
|
-
expect(node_package_version_from_beta.semver_wildcard?).to be false
|
1346
|
-
end
|
1347
|
-
end
|
1348
|
-
|
1349
|
-
context "when using a caret constraint" do
|
1350
|
-
let(:node_package_version_from_semver_caret) { node_package_version(fixture_version: "semver_caret") }
|
1351
|
-
|
1352
|
-
it "#raw returns the raw version" do
|
1353
|
-
expect(node_package_version_from_semver_caret.raw).to eq "6.6.0"
|
1354
|
-
end
|
1355
|
-
|
1356
|
-
it "#major_minor_patch returns an array" do
|
1357
|
-
expect(node_package_version_from_semver_caret.major_minor_patch).to eq ["6", "6", "0"]
|
1358
|
-
end
|
1359
|
-
|
1360
|
-
it "#skip_processing? returns false" do
|
1361
|
-
expect(node_package_version_from_semver_caret.skip_processing?).to be false
|
1362
|
-
end
|
1363
|
-
|
1364
|
-
it "#semver_wildcard? returns false" do
|
1365
|
-
expect(node_package_version_from_semver_caret.semver_wildcard?).to be false
|
1366
|
-
end
|
1367
|
-
end
|
1368
|
-
|
1369
|
-
context "when using a tilde constraint" do
|
1370
|
-
let(:node_package_version_from_semver_tilde) { node_package_version(fixture_version: "semver_tilde") }
|
1371
|
-
|
1372
|
-
it "#raw returns the raw version" do
|
1373
|
-
expect(node_package_version_from_semver_tilde.raw).to eq "6.0.2"
|
1374
|
-
end
|
1375
|
-
|
1376
|
-
it "#major_minor_patch returns an array" do
|
1377
|
-
expect(node_package_version_from_semver_tilde.major_minor_patch).to eq ["6", "0", "2"]
|
1378
|
-
end
|
1379
|
-
|
1380
|
-
it "#skip_processing? returns false" do
|
1381
|
-
expect(node_package_version_from_semver_tilde.skip_processing?).to be false
|
1382
|
-
end
|
1383
|
-
|
1384
|
-
it "#semver_wildcard? returns false" do
|
1385
|
-
expect(node_package_version_from_semver_tilde.semver_wildcard?).to be false
|
1386
|
-
end
|
1387
|
-
end
|
1388
|
-
|
1389
|
-
context "when using a relative path" do
|
1390
|
-
let(:node_package_version_from_relative_path) { node_package_version(fixture_version: "relative_path") }
|
1391
|
-
|
1392
|
-
it "#raw returns the raw version" do
|
1393
|
-
expect(node_package_version_from_relative_path.raw).to eq "../.."
|
1394
|
-
end
|
1395
|
-
|
1396
|
-
it "#major_minor_patch returns nil" do
|
1397
|
-
expect(node_package_version_from_relative_path.major_minor_patch).to be nil
|
1398
|
-
end
|
1399
|
-
|
1400
|
-
it "#skip_processing? returns true" do
|
1401
|
-
expect(node_package_version_from_relative_path.skip_processing?).to be true
|
1402
|
-
end
|
1403
|
-
|
1404
|
-
it "#semver_wildcard? returns false" do
|
1405
|
-
expect(node_package_version_from_relative_path.semver_wildcard?).to be false
|
1406
|
-
end
|
1407
|
-
end
|
1408
|
-
|
1409
|
-
context "when using a git url" do
|
1410
|
-
let(:node_package_version_from_git_url) { node_package_version(fixture_version: "git_url") }
|
1411
|
-
|
1412
|
-
it "#raw returns the raw version" do
|
1413
|
-
expect(node_package_version_from_git_url.raw).to eq "8.0.0-rc.2"
|
1414
|
-
end
|
1415
|
-
|
1416
|
-
it "#major_minor_patch returns an array" do
|
1417
|
-
expect(node_package_version_from_git_url.major_minor_patch).to eq ["8", "0", "0"]
|
1418
|
-
end
|
1419
|
-
|
1420
|
-
it "#skip_processing? returns false" do
|
1421
|
-
expect(node_package_version_from_git_url.skip_processing?).to be false
|
1422
|
-
end
|
1423
|
-
|
1424
|
-
it "#semver_wildcard? returns false" do
|
1425
|
-
expect(node_package_version_from_git_url.semver_wildcard?).to be false
|
1426
|
-
end
|
1427
|
-
end
|
1428
|
-
|
1429
|
-
context "when using a github url" do
|
1430
|
-
let(:node_package_version_from_github_url) { node_package_version(fixture_version: "github_url") }
|
1431
|
-
|
1432
|
-
it "#raw returns the raw version" do
|
1433
|
-
expect(node_package_version_from_github_url.raw).to eq "8.0.0-rc.2"
|
1434
|
-
end
|
1435
|
-
|
1436
|
-
it "#major_minor_patch returns an array" do
|
1437
|
-
expect(node_package_version_from_github_url.major_minor_patch).to eq ["8", "0", "0"]
|
1438
|
-
end
|
1439
|
-
|
1440
|
-
it "#skip_processing? returns false" do
|
1441
|
-
expect(node_package_version_from_github_url.skip_processing?).to be false
|
1442
|
-
end
|
1443
|
-
|
1444
|
-
it "#semver_wildcard? returns false" do
|
1445
|
-
expect(node_package_version_from_github_url.semver_wildcard?).to be false
|
1446
|
-
end
|
1447
|
-
end
|
1448
|
-
|
1449
|
-
context "when shakapacker is not a dependency" do
|
1450
|
-
let(:node_package_version_from_without) { node_package_version(fixture_version: "without") }
|
1451
|
-
|
1452
|
-
it "#raw returns an empty string" do
|
1453
|
-
expect(node_package_version_from_without.raw).to eq ""
|
1454
|
-
end
|
1455
|
-
|
1456
|
-
it "#major_minor_patch returns nil" do
|
1457
|
-
expect(node_package_version_from_without.major_minor_patch).to be nil
|
1458
|
-
end
|
1459
|
-
|
1460
|
-
it "#skip_processing? returns true" do
|
1461
|
-
expect(node_package_version_from_without.skip_processing?).to be true
|
1462
|
-
end
|
1463
|
-
|
1464
|
-
it "#semver_wildcard? returns false" do
|
1465
|
-
expect(node_package_version_from_without.semver_wildcard?).to be false
|
1466
|
-
end
|
1467
|
-
end
|
1468
|
-
end
|
1469
|
-
end
|