Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

chore(deps): bump unexpected to 13 and remove unused plugins (#6135)

Josh Goldberg ✨b587012724d4
diff --git a/package-lock.json b/package-lock.json
index f9a03db1..f81e6664 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -66,11 +66,9 @@
"semver": "^7.7.2",
"sinon": "^22.0.0",
"typescript": "^5.8.3",
- "unexpected": "^11.14.0",
- "unexpected-eventemitter": "^2.2.0",
- "unexpected-map": "^3.0.0",
- "unexpected-set": "^3.0.0",
- "unexpected-sinon": "^11.0.0",
+ "unexpected": "^13.2.1",
+ "unexpected-eventemitter": "^2.4.0",
+ "unexpected-sinon": "^11.1.0",
"webpack": "^5.67.0",
"webpack-cli": "^7.0.2"
},
@@ -8872,10 +8870,14 @@
}
},
"node_modules/ukkonen": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/ukkonen/-/ukkonen-1.4.0.tgz",
- "integrity": "sha512-g8SLGxflI0/VNH2C8j66KcfJXrU5StJglRQBYPNiChXFlOrqqYM1icOykOAAUgTeBpktaEuCm9hjpPinQ080PA==",
- "dev": true
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/ukkonen/-/ukkonen-2.2.0.tgz",
+ "integrity": "sha512-tUad5tv8CxhXfA0xsogqXqiaZ1ldQdNni3iNOWOTXrf2/hnYa532Fg0fk6h+IyIEOPF324aLyovVAR/H/wR8rA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
},
"node_modules/unbash": {
"version": "4.0.2",
@@ -8895,18 +8897,19 @@
"license": "MIT"
},
"node_modules/unexpected": {
- "version": "11.15.1",
- "resolved": "https://registry.npmjs.org/unexpected/-/unexpected-11.15.1.tgz",
- "integrity": "sha512-s3XfLMEKRPioyuC5cqOCl2oCgGEg4fLhIuFHcUf0IExkGXTafPlLrkcvWV76woFrXpdxWGShYpDDQXBA3lOUcA==",
+ "version": "13.2.1",
+ "resolved": "https://registry.npmjs.org/unexpected/-/unexpected-13.2.1.tgz",
+ "integrity": "sha512-6rWjexbMV4DICp8xeKHKql5JTC5No7Mz55wei2YcXGkqBAtAgfzIhFLzbDohRzN/lNtwG6+NuIvMI/0giQXOvA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"array-changes": "3.0.1",
"array-changes-async": "3.0.1",
"detect-indent": "3.0.1",
- "diff": "4.0.2",
+ "diff": "^5.0.0",
"greedy-interval-packer": "1.2.0",
- "magicpen": "^6.2.1",
- "ukkonen": "^1.4.0",
+ "magicpen": "^6.2.4",
+ "ukkonen": "^2.1.0",
"unexpected-bluebird": "2.9.34-longstack2"
}
},
@@ -8921,6 +8924,7 @@
"resolved": "https://registry.npmjs.org/unexpected-eventemitter/-/unexpected-eventemitter-2.4.0.tgz",
"integrity": "sha512-RhqPmdrD9T62HVzIdild1gGL6bkwk6QNh52FJxEmPaHTLOZBXmBASRpjzpCkRlP+E137qduV7ePSBCF5pUyLnw==",
"dev": true,
+ "license": "Apache-2.0",
"engines": {
"node": ">=8"
},
@@ -8928,25 +8932,6 @@
"unexpected": "^10 || ^11 || ^12 || ^13"
}
},
- "node_modules/unexpected-map": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/unexpected-map/-/unexpected-map-3.1.0.tgz",
- "integrity": "sha512-wOs3gRYRrt8jkxYUHU5sP28Z7haK+sRgqx9LU9xazxar0U6RcBoMZy/dULifvjKxCvfXJE19gp+QbWkAYZitTA==",
- "dev": true,
- "license": "MIT",
- "peerDependencies": {
- "unexpected": "^10.40.2 || ^11.0.0 || ^12.0.0"
- }
- },
- "node_modules/unexpected-set": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/unexpected-set/-/unexpected-set-3.3.0.tgz",
- "integrity": "sha512-TF6GG/ord4jfCyyiGq1BiNgqmRcuoAqqZ7oa2SAU33lpXNV61ZQNuBiI5TglSMasY0lrDi0O6FCE2d8lFuSG4A==",
- "dev": true,
- "peerDependencies": {
- "unexpected": "^10.37.4 || ^11.0.0-4 || ^12.0.0"
- }
- },
"node_modules/unexpected-sinon": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/unexpected-sinon/-/unexpected-sinon-11.1.0.tgz",
@@ -8959,10 +8944,11 @@
}
},
"node_modules/unexpected/node_modules/diff": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
- "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.2.tgz",
+ "integrity": "sha512-vtcDfH3TOjP8UekytvnHH1o1P4FcUdt4eQ1Y+Abap1tk/OB2MWQvcwS2ClCd1zuIhc3JKOx6p3kod8Vfys3E+A==",
"dev": true,
+ "license": "BSD-3-Clause",
"engines": {
"node": ">=0.3.1"
}
diff --git a/package.json b/package.json
index 679058b0..8ac437dc 100644
--- a/package.json
+++ b/package.json
@@ -141,11 +141,9 @@
"semver": "^7.7.2",
"sinon": "^22.0.0",
"typescript": "^5.8.3",
- "unexpected": "^11.14.0",
- "unexpected-eventemitter": "^2.2.0",
- "unexpected-map": "^3.0.0",
- "unexpected-set": "^3.0.0",
- "unexpected-sinon": "^11.0.0",
+ "unexpected": "^13.2.1",
+ "unexpected-eventemitter": "^2.4.0",
+ "unexpected-sinon": "^11.1.0",
"webpack": "^5.67.0",
"webpack-cli": "^7.0.2"
},
diff --git a/test/browser-specific/setup.cjs b/test/browser-specific/setup.cjs
index 940db58b..c9916bf7 100644
--- a/test/browser-specific/setup.cjs
+++ b/test/browser-specific/setup.cjs
@@ -4,7 +4,5 @@ process.stdout = require("browser-stdout")();
global.expect = require("unexpected")
.clone()
- .use(require("unexpected-set"))
- .use(require("unexpected-map"))
.use(require("unexpected-sinon"))
.use(require("unexpected-eventemitter"));
diff --git a/test/integration/options/parallel.spec.cjs b/test/integration/options/parallel.spec.cjs
index 3b98dda5..884d3374 100644
--- a/test/integration/options/parallel.spec.cjs
+++ b/test/integration/options/parallel.spec.cjs
@@ -479,22 +479,22 @@ describe("--parallel", function () {
const { expected, actual } = await compareReporters("json");
expected.output = JSON.parse(expected.output);
actual.output = JSON.parse(actual.output);
- return expect(actual, "to satisfy", {
+ expect(actual, "to satisfy", {
passing: expected.passing,
failing: expected.failing,
pending: expected.pending,
code: expected.code,
- output: {
- stats: {
- suites: expected.output.stats.suites,
- tests: expected.output.stats.tests,
- passes: expected.output.stats.passes,
- pending: expected.output.stats.pending,
- failures: expected.output.stats.failures,
- },
- tests: expected.tests,
+ });
+ expect(actual.output, "to satisfy", {
+ stats: {
+ suites: expected.output.stats.suites,
+ tests: expected.output.stats.tests,
+ passes: expected.output.stats.passes,
+ pending: expected.output.stats.pending,
+ failures: expected.output.stats.failures,
},
});
+ expect(actual.output.tests, "to satisfy", expected.output.tests);
});
});
diff --git a/test/setup.cjs b/test/setup.cjs
index c5f317f1..99943eb9 100644
--- a/test/setup.cjs
+++ b/test/setup.cjs
@@ -6,6 +6,4 @@ global.expect = unexpected
.clone()
.use(require("unexpected-sinon"))
.use(require("unexpected-eventemitter"))
- .use(require("unexpected-map"))
- .use(require("unexpected-set"))
.use(require("./assertions.cjs"));
diff --git a/test/unit/errors.spec.cjs b/test/unit/errors.spec.cjs
index 45d865d6..49bd43a0 100644
--- a/test/unit/errors.spec.cjs
+++ b/test/unit/errors.spec.cjs
@@ -1,7 +1,7 @@
"use strict";
var errors = require("../../lib/errors.js");
-var constants = require("../../lib/error-constants.js");
+var { constants } = require("../../lib/error-constants.js");
const sinon = require("sinon");
const { createNoFilesMatchPatternError } = require("../../lib/errors.js");
diff --git a/test/unit/mocha.spec.cjs b/test/unit/mocha.spec.cjs
index b27f6bec..ab893b33 100644
--- a/test/unit/mocha.spec.cjs
+++ b/test/unit/mocha.spec.cjs
@@ -615,8 +615,7 @@ describe("Mocha", function () {
mocha.suite,
{
delay: mocha.options.delay,
- cleanReferencesAfterRun:
- mocha.options.cleanReferencesAfterRun,
+ cleanReferencesAfterRun: mocha._cleanReferencesAfterRun,
},
],
}).and("was called once");
diff --git a/test/unit/plugin-loader.spec.cjs b/test/unit/plugin-loader.spec.cjs
index 444c9989..c4711ebc 100644
--- a/test/unit/plugin-loader.spec.cjs
+++ b/test/unit/plugin-loader.spec.cjs
@@ -18,9 +18,11 @@ describe("plugin module", function () {
it("should register the custom plugins", function () {
const plugin = { exportName: "mochaBananaPhone" };
expect(
- new PluginLoader({ pluginDefs: [plugin] }).registered,
+ Object.fromEntries(
+ new PluginLoader({ pluginDefs: [plugin] }).registered,
+ ),
"to satisfy",
- new Map([["mochaBananaPhone", plugin]]),
+ { mochaBananaPhone: plugin },
);
});
});
@@ -168,11 +170,9 @@ describe("plugin module", function () {
it("should retain the value of any matching property in its mapping", function () {
const func = () => {};
pluginLoader.load({ mochaBananaPhone: func });
- expect(
- pluginLoader.loaded,
- "to satisfy",
- new Map([["mochaBananaPhone", [func]]]),
- );
+ expect(Object.fromEntries(pluginLoader.loaded), "to satisfy", {
+ mochaBananaPhone: [func],
+ });
});
it("should call the associated validator, if present", function () {
@@ -259,19 +259,15 @@ describe("plugin module", function () {
});
it("should add the implementation to the internal mapping", function () {
- expect(
- pluginLoader.loaded,
- "to satisfy",
- new Map([["foo", expect.it("to have length", 1)]]),
- );
+ expect(Object.fromEntries(pluginLoader.loaded), "to satisfy", {
+ foo: expect.it("to have length", 1),
+ });
});
it("should not add an implementation of plugins not present", function () {
- expect(
- pluginLoader.loaded,
- "to satisfy",
- new Map([["bar", expect.it("to be empty")]]),
- );
+ expect(Object.fromEntries(pluginLoader.loaded), "to satisfy", {
+ bar: expect.it("to be empty"),
+ });
});
});