From 69358d5bc468f521d5c93ccd6fc0852c8d439a75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Pedersen?= Date: Fri, 19 Jan 2024 10:55:50 +0100 Subject: [PATCH] Bump chai to 5.0.0 - fix requires -> dynamic import - should registered vi -r on command Change-Id: Iadf9a5146282cbbc183b2d6b8e5db2da33bf2f13 --- package-lock.json | 68 +++++++++++++++++++----------------------- package.json | 8 ++--- test/config/pretest.js | 11 ++++--- 3 files changed, 41 insertions(+), 46 deletions(-) diff --git a/package-lock.json b/package-lock.json index ada62d070..63a3d38e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "@nestjs/schematics": "^10.0.1", "@nestjs/testing": "^9.0.0", "@types/bcrypt": "^5.0.0", - "@types/chai": "^4.3.3", + "@types/chai": "^4.3.6", "@types/express": "^4.17.13", "@types/express-session": "^1.17.4", "@types/jest": "^27.0.2", @@ -71,8 +71,8 @@ "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^6.3.0", "@typescript-eslint/parser": "^6.3.0", - "chai": "^4.3.6", - "chai-http": "^4.3.0", + "chai": "^5.0.0", + "chai-http": "^4.3.6", "concurrently": "^8.0.1", "eslint": "^8.46.0", "eslint-config-loopback": "^13.1.0", @@ -4121,12 +4121,12 @@ } }, "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", "dev": true, "engines": { - "node": "*" + "node": ">=12" } }, "node_modules/async": { @@ -4733,21 +4733,19 @@ ] }, "node_modules/chai": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", - "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.0.0.tgz", + "integrity": "sha512-HO5p0oEKd5M6HEcwOkNAThAE3j960vIZvVcc0t2tI06Dd0ATu69cEnMB2wOhC5/ZyQ6m67w3ePjU/HzXsSsdBA==", "dev": true, "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.3", - "deep-eql": "^4.1.3", - "get-func-name": "^2.0.2", - "loupe": "^2.3.6", - "pathval": "^1.1.1", - "type-detect": "^4.0.8" + "assertion-error": "^2.0.1", + "check-error": "^2.0.0", + "deep-eql": "^5.0.1", + "loupe": "^3.0.0", + "pathval": "^2.0.0" }, "engines": { - "node": ">=4" + "node": ">=12" } }, "node_modules/chai-http": { @@ -4850,15 +4848,12 @@ } }, "node_modules/check-error": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.0.0.tgz", + "integrity": "sha512-tjLAOBHKVxtPoHe/SA7kNOMvhCRdCJ3vETdeY0RuAc9popf+hyaSV6ZEg9hr4cpWF7jmo/JSWEnLDrnijS9Tog==", "dev": true, - "dependencies": { - "get-func-name": "^2.0.2" - }, "engines": { - "node": "*" + "node": ">= 16" } }, "node_modules/cheerio": { @@ -5553,13 +5548,10 @@ "dev": true }, "node_modules/deep-eql": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", - "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.1.tgz", + "integrity": "sha512-nwQCf6ne2gez3o1MxWifqkciwt0zhl0LO1/UwVu4uMBuPmflWM4oQ70XMqHqnBJA+nhzncaqL9HVL6KkHJ28lw==", "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, "engines": { "node": ">=6" } @@ -9545,9 +9537,9 @@ } }, "node_modules/loupe": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", - "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.0.tgz", + "integrity": "sha512-qKl+FrLXUhFuHUoDJG7f8P8gEMHq9NFS0c6ghXG1J0rldmZFQZoNVv/vyirE9qwCIhWZDsvEFd1sbFu3GvRQFg==", "dev": true, "dependencies": { "get-func-name": "^2.0.1" @@ -11456,12 +11448,12 @@ } }, "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", "dev": true, "engines": { - "node": "*" + "node": ">= 14.16" } }, "node_modules/pause": { diff --git a/package.json b/package.json index 6d13ce72f..173aef162 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:api": "npm run test:api:jest --maxWorkers=50% && concurrently -k -s first \"wait-on http://localhost:3000/explorer/ && npm run test:api:mocha\" \"npm run start\"", "test:api:jest": "jest --config ./test/config/jest-e2e.json --maxWorkers=50%", - "test:api:mocha": "mocha --config ./test/config/.mocharc.json", + "test:api:mocha": "mocha --config ./test/config/.mocharc.json -r chai/register-should.js ", "prepare:local": "docker-compose -f CI/E2E/docker-compose-local.yaml --env-file CI/E2E/.env.elastic-search up -d && cp functionalAccounts.json.test functionalAccounts.json" }, "dependencies": { @@ -81,7 +81,7 @@ "@nestjs/schematics": "^10.0.1", "@nestjs/testing": "^9.0.0", "@types/bcrypt": "^5.0.0", - "@types/chai": "^4.3.3", + "@types/chai": "^4.3.6", "@types/express": "^4.17.13", "@types/express-session": "^1.17.4", "@types/jest": "^27.0.2", @@ -97,8 +97,8 @@ "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^6.3.0", "@typescript-eslint/parser": "^6.3.0", - "chai": "^4.3.6", - "chai-http": "^4.3.0", + "chai": "^5.0.0", + "chai-http": "^4.3.6", "concurrently": "^8.0.1", "eslint": "^8.46.0", "eslint-config-loopback": "^13.1.0", diff --git a/test/config/pretest.js b/test/config/pretest.js index 1ae054e72..3a292a628 100644 --- a/test/config/pretest.js +++ b/test/config/pretest.js @@ -1,9 +1,12 @@ /* eslint-disable @typescript-eslint/no-var-requires */ //NOTE: Here we load and initialize some global variables that are used throughout the tests -const chai = require("chai"); -const chaiHttp = require("chai-http"); -chai.should(); -chai.use(chaiHttp); + +var chaiHttp = require("chai-http"); +async function loadChai() { + const { chai } = import("chai"); + chai.use(chaiHttp); +} +loadChai(); global.appUrl = "http://localhost:3000"; global.request = require("supertest");