-
-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prerequisites: Raise if Node version unsupported (#1202)
Follow-up to #1201 It's not enough to ensure Node is installed. We also need to ensure the consumer has the supported minimum version installed. Otherwise, subsequent generators will raise errors like so: ``` error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18.12.0". Got "18.0.0" error Found incompatible module. ``` We select `v20.0.0` as our minimum supported version because it is slated for Active LTS, but is not bleeding edge at [this time][] We also raise when calling the template to avoid unnecessarily generating a new Rails application. [this time]: https://nodejs.org/en/about/previous-releases
- Loading branch information
1 parent
6f68a52
commit 688622e
Showing
10 changed files
with
100 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
require "test_helper" | ||
|
||
class Suspenders::GeneratorsTest < ActiveSupport::TestCase | ||
class APIAppUnsupportedTest < Suspenders::GeneratorsTest | ||
class APIAppUnsupportedTest < ActiveSupport::TestCase | ||
test "message returns a custom message" do | ||
expected = "This generator cannot be used on API only applications." | ||
|
||
assert_equal expected, Suspenders::Generators::APIAppUnsupported::Error.new.message | ||
end | ||
end | ||
|
||
class DatabaseUnsupportedTest < Suspenders::GeneratorsTest | ||
class DatabaseUnsupportedTest < ActiveSupport::TestCase | ||
test "message returns a custom message" do | ||
expected = "This generator requires PostgreSQL" | ||
|
||
assert_equal expected, Suspenders::Generators::DatabaseUnsupported::Error.new.message | ||
end | ||
end | ||
|
||
class NodeNotInstalledTest < ActiveSupport::TestCase | ||
test "message returns a custom message" do | ||
expected = "This generator requires Node" | ||
|
||
assert_equal expected, Suspenders::Generators::NodeNotInstalled::Error.new.message | ||
end | ||
end | ||
|
||
class NodeVersionUnsupportedTest < ActiveSupport::TestCase | ||
test "message returns a custom message" do | ||
expected = "This generator requires Node >= #{Suspenders::MINIMUM_NODE_VERSION}" | ||
|
||
assert_equal expected, Suspenders::Generators::NodeVersionUnsupported::Error.new.message | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters