From 4c89098fe5f03b09317ab6ef063fa8a4dc89a471 Mon Sep 17 00:00:00 2001 From: Eduard Florin Dumitru Date: Fri, 2 Feb 2024 03:10:28 +0100 Subject: [PATCH] node: fix failing tests - configure Node to ignore `UnhandledPromiseRejection` - this used to be default behaviour in Node 14 and was changed to throw in Node 15 (the pipeline doesn't request a specific version of Node which means at the time of writing it's using Node 20) see this anchor: https://nodejs.org/api/cli.html#--unhandled-rejectionsmode - `npm test` calls `mocha` which is able to pass through the setting to `node(.exe)` --- src/Clients/nodejs/package.json | 2 +- src/Clients/nodejs/test/mocha.env.js | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Clients/nodejs/package.json b/src/Clients/nodejs/package.json index d3d31669..ecc5cb7a 100644 --- a/src/Clients/nodejs/package.json +++ b/src/Clients/nodejs/package.json @@ -23,7 +23,7 @@ "clean:nyc": "rimraf .nyc_output", "pretest": "npm run clean:test & npm run lint", "test": "run-s test:*", - "test:unit": "nyc mocha --opts ./test/mocha.opts --exit", + "test:unit": "nyc mocha --opts ./test/mocha.opts --exit --unhandled-rejections=none", "test:report": "nyc report --reporter=html", "posttest": "nyc report --reporter=text-lcov > ./reports/coverage.lcov & nyc report --reporter=text", "lint": "tslint --project ./tsconfig.json", diff --git a/src/Clients/nodejs/test/mocha.env.js b/src/Clients/nodejs/test/mocha.env.js index b303097e..f451098b 100644 --- a/src/Clients/nodejs/test/mocha.env.js +++ b/src/Clients/nodejs/test/mocha.env.js @@ -34,6 +34,3 @@ Mock.configure({ chai.spy.on(object, key); }, }); - -require('temp') - .track();