bugger.
All challenges/TypeScriptmediumthe-prerelease-that-misses-the-range-v1
THE INVESTIGATION

The prerelease that misses the range

A prerelease option works for one range spelling but excludes the lower boundary of its equivalent.

Real incidentsVersion rangesRegression testing

What’s going wrong

Input is an array of at most 100 {range, includePrerelease, versions} rows. range is ~M, ~M.m or ~M.m.p, with numeric components 0..99 and no leading zeros. versions contains at most 100 valid SemVer strings with three numeric core components 0..100, optional valid prerelease identifiers and optional build metadata. Open tildes (~M or ~M.m) accept prereleases at their minimum core only when includePrerelease is true; a fully specified ~M.m.p never accepts prereleases of its exact minimum core. Other prereleases within the core interval require includePrerelease. The next major (for ~M) or minor (otherwise), including ALL its prereleases, is excluded. Build metadata never affects acceptance. Return an array of boolean arrays. Explicit prerelease ranges, wildcard spellings and other operators are out of scope.

Expected behavior

Preserve an open range’s prerelease lower boundary.

Reproduction

01 Open tilde includes its lower prerelease
[{"range":"~1.2","includePrerelease":true,"versions":["1.2.0-rc.1"]}]
[[true]]
02 Stable releases control
[{"range":"~1.2","includePrerelease":false,"versions":["1.2.0","1.2.8","1.3.0"]}]
[[true,true,false]]
03 Exact lower bound remains a release
[{"range":"~1.2.3","includePrerelease":true,"versions":["1.2.3-rc.1","1.2.3","1.2.4-rc.1"]}]
[[false,true,true]]

Before you begin

  • TypeScript arrays and predicates
  • Semantic version components and prereleases

Need a nudge?

Reveal one investigation hint at a time. Try each clue before opening the next.

    The bug is intentional. Run the starter code to see it fail, then work toward a fix. Difficulty is provisional.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.