Skip to content

[BUG] Raw includes build only before modification #562

Closed
@skeletorXVI

Description

@skeletorXVI

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When creating a new instance of the SemVer class form a version string with a build, the build segment is included in the raw field.

Expected Behavior

The build segment should either be or not be part of the raw field, but not a mix of both.

Steps To Reproduce

Copy and run the following example code which should log true but instead logs false.

const { SemVer } = require("semver");

const freshInstance = new SemVer("1.0.0-rc.2+build.4");
const modifiedInstance = new SemVer("1.0.0-rc.1+build.4");
modifiedInstance.inc("prerelease", "rc");
console.log(freshInstance.raw === modifiedInstance.raw);

Environment

  • yarn: 3.5.0
  • Node: v16.19.1
  • OS: Pop!Os 22.04
  • semver: 7.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 1high priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions