Skip to content

Commit b904bb1

Browse files
fix dependency test
1 parent a9142ed commit b904bb1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/action/dependency.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ describe('package.json', function () {
5757
.split('\n')
5858
.join('');
5959

60-
for (const [depName, depVersion] of Object.entries(peerDependencies)) {
61-
const depMajor = depVersion.split('.')[0];
60+
for (const [depName, depVersion] of Object.entries(peerDependencies as Record<string, string>)) {
61+
// If a dependency specifies `alpha|beta`, the major version will fail to install because
62+
// an alpha < the major of that version (ex: [email protected] < [email protected])
63+
const depInstallSpecifier = /alpha|beta/.test(depVersion) ? depVersion : depVersion.split('.')[0];
6264

6365
context(`when ${depName} is NOT installed`, () => {
6466
beforeEach(async () => {
@@ -91,7 +93,7 @@ describe('package.json', function () {
9193

9294
context(`when ${depName} is installed`, () => {
9395
beforeEach(async function () {
94-
execSync(`npm install --no-save -D "${depName}"@"${depMajor}"`);
96+
execSync(`npm install --no-save -D "${depName}"@"${depInstallSpecifier}"`);
9597
});
9698

9799
it(`driver is importable`, () => {

0 commit comments

Comments
 (0)