From e082ad359690eeffaa0d156aa706fb064d0736a7 Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Wed, 1 Nov 2023 11:20:47 +0100 Subject: [PATCH] test(node): Relax an assertion 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 --- .../node/src/funTest/kotlin/NpmFunTest.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/package-managers/node/src/funTest/kotlin/NpmFunTest.kt b/plugins/package-managers/node/src/funTest/kotlin/NpmFunTest.kt index 04c7860e8684b..8efcb966ae3b1 100644 --- a/plugins/package-managers/node/src/funTest/kotlin/NpmFunTest.kt +++ b/plugins/package-managers/node/src/funTest/kotlin/NpmFunTest.kt @@ -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 @@ -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" } }