Skip to content

Commit

Permalink
Merge pull request #564 from nomiclabs/fix-plugin-dependencies-valida…
Browse files Browse the repository at this point in the history
…tion

Make plugins dependency validation accept prerelease versions
  • Loading branch information
alcuadrado authored May 9, 2020
2 parents 953f8be + 9d21f6f commit 3ba7dd6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/buidler-core/src/internal/core/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ export function usePlugin(

const installedVersion = dependencyPackageJson.version;

if (!semver.satisfies(installedVersion, versionSpec)) {
if (
!semver.satisfies(installedVersion, versionSpec, {
includePrerelease: true,
})
) {
throw new BuidlerError(ERRORS.PLUGINS.DEPENDENCY_VERSION_MISMATCH, {
plugin: pluginName,
dependency: dependencyName,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/buidler-core/test/internal/core/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ describe("plugin system", function () {
assert.isTrue(globalAsAny.loaded);
});

it("Should load a plugin if with a prerelease version of a dependency", function () {
usePlugin(ctx, "requires-prerelease", projectPath);
assert.isTrue(globalAsAny.loaded);
});

it("Should fail if a peer dependency is missing", function () {
expectBuidlerError(
() => usePlugin(ctx, "requires-missing-pack", projectPath),
Expand Down

0 comments on commit 3ba7dd6

Please sign in to comment.