From 7285e05e5abd0ab637440811f653d118b046aa93 Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Mon, 16 Jan 2023 18:23:46 -0600 Subject: [PATCH] fix(aggregate-error): upgraded to the latest version BREAKING CHANGE: due to the aggregate-error upgrade, thrown errors are no longer iterable, but instead list the errors under an `errors` property --- index.js | 8 +- package-lock.json | 283 ++++++++++++++++++++++++++---------- package.json | 2 +- test/get-pkg.test.js | 12 +- test/integration.test.js | 118 ++++++++------- test/set-npmrc-auth.test.js | 4 +- 6 files changed, 286 insertions(+), 141 deletions(-) diff --git a/index.js b/index.js index 178d132e..590eace3 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,7 @@ export async function verifyConditions(pluginConfig, context) { await verifyNpmAuth(npmrc, pkg, context); } } catch (error) { - errors.push(...error); + errors.push(...error.errors); } if (errors.length > 0) { @@ -53,7 +53,7 @@ export async function prepare(pluginConfig, context) { await verifyNpmAuth(npmrc, pkg, context); } } catch (error) { - errors.push(...error); + errors.push(...error.errors); } if (errors.length > 0) { @@ -75,7 +75,7 @@ export async function publish(pluginConfig, context) { await verifyNpmAuth(npmrc, pkg, context); } } catch (error) { - errors.push(...error); + errors.push(...error.errors); } if (errors.length > 0) { @@ -100,7 +100,7 @@ export async function addChannel(pluginConfig, context) { await verifyNpmAuth(npmrc, pkg, context); } } catch (error) { - errors.push(...error); + errors.push(...error.errors); } if (errors.length > 0) { diff --git a/package-lock.json b/package-lock.json index b6c90e34..ff2cdbf0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@semantic-release/error": "^3.0.0", - "aggregate-error": "^3.0.0", + "aggregate-error": "^4.0.1", "execa": "^6.1.0", "fs-extra": "^11.0.0", "lodash-es": "^4.17.21", @@ -410,6 +410,28 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, + "node_modules/@semantic-release/github/node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@semantic-release/github/node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/@semantic-release/github/node_modules/globby": { "version": "11.1.0", "dev": true, @@ -468,6 +490,28 @@ "semantic-release": ">=19.0.0" } }, + "node_modules/@semantic-release/npm/node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@semantic-release/npm/node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/@semantic-release/npm/node_modules/crypto-random-string": { "version": "2.0.0", "dev": true, @@ -815,14 +859,29 @@ } }, "node_modules/aggregate-error": { - "version": "3.1.0", - "license": "MIT", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", + "integrity": "sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==", "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" + "clean-stack": "^4.0.0", + "indent-string": "^5.0.0" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/aggregate-error/node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/ansi-escapes": { @@ -1487,10 +1546,17 @@ "license": "MIT" }, "node_modules/clean-stack": { - "version": "2.2.0", - "license": "MIT", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-4.2.0.tgz", + "integrity": "sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==", + "dependencies": { + "escape-string-regexp": "5.0.0" + }, "engines": { - "node": ">=6" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/clean-yaml-object": { @@ -2018,6 +2084,28 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/del/node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/del/node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/del/node_modules/globby": { "version": "11.1.0", "dev": true, @@ -2302,7 +2390,6 @@ }, "node_modules/escape-string-regexp": { "version": "5.0.0", - "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -2958,6 +3045,7 @@ }, "node_modules/indent-string": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -6293,46 +6381,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-map/node_modules/aggregate-error": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "clean-stack": "^4.0.0", - "indent-string": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-map/node_modules/clean-stack": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-map/node_modules/indent-string": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/p-reduce": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.1.0.tgz", @@ -7072,6 +7120,19 @@ "node": ">=16 || ^14.17" } }, + "node_modules/semantic-release/node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/semantic-release/node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -7081,6 +7142,15 @@ "node": ">=8" } }, + "node_modules/semantic-release/node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/semantic-release/node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -8653,6 +8723,22 @@ "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", "dev": true }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, "globby": { "version": "11.1.0", "dev": true, @@ -8696,6 +8782,22 @@ "tempy": "^1.0.0" }, "dependencies": { + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, "crypto-random-string": { "version": "2.0.0", "dev": true @@ -8942,10 +9044,19 @@ } }, "aggregate-error": { - "version": "3.1.0", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", + "integrity": "sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==", "requires": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" + "clean-stack": "^4.0.0", + "indent-string": "^5.0.0" + }, + "dependencies": { + "indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==" + } } }, "ansi-escapes": { @@ -9364,7 +9475,12 @@ "dev": true }, "clean-stack": { - "version": "2.2.0" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-4.2.0.tgz", + "integrity": "sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==", + "requires": { + "escape-string-regexp": "5.0.0" + } }, "clean-yaml-object": { "version": "0.1.0", @@ -9708,6 +9824,22 @@ "slash": "^3.0.0" }, "dependencies": { + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, "globby": { "version": "11.1.0", "dev": true, @@ -9909,8 +10041,7 @@ "dev": true }, "escape-string-regexp": { - "version": "5.0.0", - "dev": true + "version": "5.0.0" }, "esprima": { "version": "4.0.1", @@ -10339,7 +10470,8 @@ "dev": true }, "indent-string": { - "version": "4.0.0" + "version": "4.0.0", + "dev": true }, "inflight": { "version": "1.0.6", @@ -12498,27 +12630,6 @@ "dev": true, "requires": { "aggregate-error": "^4.0.0" - }, - "dependencies": { - "aggregate-error": { - "version": "4.0.1", - "dev": true, - "requires": { - "clean-stack": "^4.0.0", - "indent-string": "^5.0.0" - } - }, - "clean-stack": { - "version": "4.2.0", - "dev": true, - "requires": { - "escape-string-regexp": "5.0.0" - } - }, - "indent-string": { - "version": "5.0.0", - "dev": true - } } }, "p-reduce": { @@ -12953,12 +13064,28 @@ "yargs": "^16.2.0" }, "dependencies": { + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, "cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", diff --git a/package.json b/package.json index 7e0d0d71..be82aabc 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ ], "dependencies": { "@semantic-release/error": "^3.0.0", - "aggregate-error": "^3.0.0", + "aggregate-error": "^4.0.1", "execa": "^6.1.0", "fs-extra": "^11.0.0", "lodash-es": "^4.17.21", diff --git a/test/get-pkg.test.js b/test/get-pkg.test.js index 1fb92df6..3fc58b1c 100644 --- a/test/get-pkg.test.js +++ b/test/get-pkg.test.js @@ -27,7 +27,9 @@ test("Verify name and version then return parsed package.json from a sub-directo test("Throw error if missing package.json", async (t) => { const cwd = temporaryDirectory(); - const [error] = await t.throwsAsync(getPkg({}, { cwd })); + const { + errors: [error], + } = await t.throwsAsync(getPkg({}, { cwd })); t.is(error.name, "SemanticReleaseError"); t.is(error.code, "ENOPKG"); @@ -37,7 +39,9 @@ test("Throw error if missing package name", async (t) => { const cwd = temporaryDirectory(); await fs.outputJson(path.resolve(cwd, "package.json"), { version: "0.0.0" }); - const [error] = await t.throwsAsync(getPkg({}, { cwd })); + const { + errors: [error], + } = await t.throwsAsync(getPkg({}, { cwd })); t.is(error.name, "SemanticReleaseError"); t.is(error.code, "ENOPKGNAME"); @@ -47,7 +51,9 @@ test("Throw error if package.json is malformed", async (t) => { const cwd = temporaryDirectory(); await fs.writeFile(path.resolve(cwd, "package.json"), "{name: 'package',}"); - const [error] = await t.throwsAsync(getPkg({}, { cwd })); + const { + errors: [error], + } = await t.throwsAsync(getPkg({}, { cwd })); t.is(error.name, "JSONError"); }); diff --git a/test/integration.test.js b/test/integration.test.js index e7250920..a4a34227 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -96,7 +96,9 @@ test("Throws error if NPM token is invalid", async (t) => { const pkg = { name: "published", version: "1.0.0", publishConfig: { registry: npmRegistry.url } }; await fs.outputJson(path.resolve(cwd, "package.json"), pkg); - const [error] = await t.throwsAsync( + const { + errors: [error], + } = await t.throwsAsync( t.context.m.verifyConditions( {}, { cwd, env, options: {}, stdout: t.context.stdout, stderr: t.context.stderr, logger: t.context.logger } @@ -186,21 +188,23 @@ test("Throw SemanticReleaseError Array if config option are not valid in verifyC const tarballDir = 42; const pkgRoot = 42; const errors = [ - ...(await t.throwsAsync( - t.context.m.verifyConditions( - {}, - { - cwd, - env: {}, - options: { - publish: ["@semantic-release/github", { path: "@semantic-release/npm", npmPublish, tarballDir, pkgRoot }], - }, - stdout: t.context.stdout, - stderr: t.context.stderr, - logger: t.context.logger, - } + ...( + await t.throwsAsync( + t.context.m.verifyConditions( + {}, + { + cwd, + env: {}, + options: { + publish: ["@semantic-release/github", { path: "@semantic-release/npm", npmPublish, tarballDir, pkgRoot }], + }, + stdout: t.context.stdout, + stderr: t.context.stderr, + logger: t.context.logger, + } + ) ) - )), + ).errors, ]; t.is(errors[0].name, "SemanticReleaseError"); @@ -411,20 +415,22 @@ test("Throw SemanticReleaseError Array if config option are not valid in publish const pkgRoot = 42; const errors = [ - ...(await t.throwsAsync( - t.context.m.publish( - { npmPublish, tarballDir, pkgRoot }, - { - cwd, - env: {}, - options: { publish: ["@semantic-release/github", "@semantic-release/npm"] }, - nextRelease: { version: "1.0.0" }, - stdout: t.context.stdout, - stderr: t.context.stderr, - logger: t.context.logger, - } + ...( + await t.throwsAsync( + t.context.m.publish( + { npmPublish, tarballDir, pkgRoot }, + { + cwd, + env: {}, + options: { publish: ["@semantic-release/github", "@semantic-release/npm"] }, + nextRelease: { version: "1.0.0" }, + stdout: t.context.stdout, + stderr: t.context.stderr, + logger: t.context.logger, + } + ) ) - )), + ).errors, ]; t.is(errors[0].name, "SemanticReleaseError"); @@ -492,20 +498,22 @@ test("Throw SemanticReleaseError Array if config option are not valid in prepare const pkgRoot = 42; const errors = [ - ...(await t.throwsAsync( - t.context.m.prepare( - { npmPublish, tarballDir, pkgRoot }, - { - cwd, - env: {}, - options: { publish: ["@semantic-release/github", "@semantic-release/npm"] }, - nextRelease: { version: "1.0.0" }, - stdout: t.context.stdout, - stderr: t.context.stderr, - logger: t.context.logger, - } + ...( + await t.throwsAsync( + t.context.m.prepare( + { npmPublish, tarballDir, pkgRoot }, + { + cwd, + env: {}, + options: { publish: ["@semantic-release/github", "@semantic-release/npm"] }, + nextRelease: { version: "1.0.0" }, + stdout: t.context.stdout, + stderr: t.context.stderr, + logger: t.context.logger, + } + ) ) - )), + ).errors, ]; t.is(errors[0].name, "SemanticReleaseError"); @@ -677,20 +685,22 @@ test("Throw SemanticReleaseError Array if config option are not valid in addChan const pkgRoot = 42; const errors = [ - ...(await t.throwsAsync( - t.context.m.addChannel( - { npmPublish, tarballDir, pkgRoot }, - { - cwd, - env, - options: { publish: ["@semantic-release/github", "@semantic-release/npm"] }, - nextRelease: { version: "1.0.0" }, - stdout: t.context.stdout, - stderr: t.context.stderr, - logger: t.context.logger, - } + ...( + await t.throwsAsync( + t.context.m.addChannel( + { npmPublish, tarballDir, pkgRoot }, + { + cwd, + env, + options: { publish: ["@semantic-release/github", "@semantic-release/npm"] }, + nextRelease: { version: "1.0.0" }, + stdout: t.context.stdout, + stderr: t.context.stderr, + logger: t.context.logger, + } + ) ) - )), + ).errors, ]; t.is(errors[0].name, "SemanticReleaseError"); diff --git a/test/set-npmrc-auth.test.js b/test/set-npmrc-auth.test.js index 5a5944b4..85749c73 100644 --- a/test/set-npmrc-auth.test.js +++ b/test/set-npmrc-auth.test.js @@ -117,7 +117,9 @@ test.serial('Throw error if "NPM_TOKEN" is missing', async (t) => { const npmrc = temporaryFile({ name: ".npmrc" }); const setNpmrcAuth = (await import("../lib/set-npmrc-auth.js")).default; - const [error] = await t.throwsAsync( + const { + errors: [error], + } = await t.throwsAsync( setNpmrcAuth(npmrc, "http://custom.registry.com", { cwd, env: {}, logger: t.context.logger }) );