Skip to content

Commit

Permalink
test(node): Relax an assertion
Browse files Browse the repository at this point in the history
ORT's Npm integration maps Npm's error output to a set of issues. In
case of a malformed `package.json`, this yields a single issue with the
currently used Npm version. A more recent Npm versions, 10.1.0, yields
two issues. Also the wording of the issue to be matched slightly
differs.

So, relax the test assertion such that it does not break when upgrading
Npm to 10.1.0 which is needed in order to upgrade Node to version 20.

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau committed Nov 1, 2023
1 parent 0820a7b commit e082ad3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions plugins/package-managers/node/src/funTest/kotlin/NpmFunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ package org.ossreviewtoolkit.plugins.packagemanagers.node

import io.kotest.core.spec.style.WordSpec
import io.kotest.engine.spec.tempdir
import io.kotest.inspectors.forAtLeastOne
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.should
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldHave
import io.kotest.matchers.string.shouldContain

import org.ossreviewtoolkit.analyzer.managers.create
Expand Down Expand Up @@ -97,11 +99,10 @@ class NpmFunTest : WordSpec({

val result = create("NPM", allowDynamicVersions = true).resolveSingleProject(definitionFile)

result.issues shouldHaveSize 1
with(result.issues.first()) {
source shouldBe "NPM"
severity shouldBe Severity.ERROR
message shouldContain "Unexpected token \"<\" (0x3C) in JSON at position 0 while parsing \"<>\""
result.issues.forAtLeastOne {
it.source shouldBe "NPM"
it.severity shouldBe Severity.ERROR
it.message shouldContain "Unexpected token"
}
}

Expand Down

0 comments on commit e082ad3

Please sign in to comment.