Skip to content

Commit 31d3035

Browse files
committed
Support pre-release versions in tests
1 parent d044674 commit 31d3035

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/helpers/project-versions.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const projectVersionPairs = [];
99
projects.forEach((p) => {
1010
const fullProjectVersions = readdirSync(
1111
`json-docs/${p}`
12-
).filter((v) => v.match(/\d+\.\d+\.\d+/));
12+
).filter((v) => v.match(/^\d+\.\d+\.\d+(-[\w\.]+)?$/));
1313

1414
const projectVersions = fullProjectVersions.map((v) => {
15-
let [, major, minor] = v.match(/(\d+)\.(\d+)\.\d+/);
15+
let [, major, minor] = v.match(/^(\d+)\.(\d+)\.\d+(?:-[\w\.]+)?$/);
1616
return `${major}.${minor}`;
1717
});
1818

@@ -21,12 +21,12 @@ projects.forEach((p) => {
2121
uniqueProjectVersions.forEach((uniqVersion) => {
2222
const sortedPatchVersions = fullProjectVersions
2323
.filter((projectVersion) => {
24-
return semver.satisfies(projectVersion, uniqVersion);
24+
return projectVersion.startsWith(uniqVersion + '.');
2525
})
26-
.sort(cmp);
27-
projectVersionPairs.push([p, sortedPatchVersions[sortedPatchVersions.length - 1]])
26+
.sort(semver.compare);
2827

29-
})
28+
projectVersionPairs.push([p, sortedPatchVersions[sortedPatchVersions.length - 1]]);
29+
});
3030
});
3131

3232
module.exports = projectVersionPairs;

0 commit comments

Comments
 (0)