From fd15c494eb93349501884d5aed1ab4492c767e67 Mon Sep 17 00:00:00 2001 From: DavertMik Date: Tue, 13 Oct 2026 02:14:38 +0300 Subject: [PATCH 1/2] fix(deps): bump axios, @xmldom/xmldom and mocha to patched versions Closes #5731. mocha 12 pulls serialize-javascript 7 (GHSA-5c6j-r48x-rmvq, GHSA-qj8w-gfj5-8c6v). Uses caret ranges so patch releases flow through. mocha 12 is ESM with named exports, so internal imports were updated. Co-Authored-By: Claude Opus 5.5 --- lib/mocha/cli.js | 4 ++-- lib/mocha/index.js | 3 +-- lib/mocha/suite.js | 2 +- lib/mocha/test.js | 3 +-- lib/mocha/ui.js | 6 +++--- package.json | 8 ++++---- test/unit/circular_reference_test.js | 2 +- test/unit/data/ui_test.js | 4 ++-- test/unit/mocha/retry_integration_test.js | 2 +- test/unit/mocha/test_clone_test.js | 4 ++-- test/unit/mocha/ui_test.js | 4 ++-- 11 files changed, 20 insertions(+), 22 deletions(-) diff --git a/lib/mocha/cli.js b/lib/mocha/cli.js index 56b637922..192ded59a 100644 --- a/lib/mocha/cli.js +++ b/lib/mocha/cli.js @@ -1,5 +1,5 @@ -import mocha from 'mocha' -const { reporters: { Base } } = mocha +import { reporters } from 'mocha' +const { Base } = reporters import ms from 'ms' import figures from 'figures' import { readFileSync } from 'fs' diff --git a/lib/mocha/index.js b/lib/mocha/index.js index 8f7a2ef12..f64016a0e 100644 --- a/lib/mocha/index.js +++ b/lib/mocha/index.js @@ -1,5 +1,4 @@ -import Suite from 'mocha/lib/suite.js' -import Test from 'mocha/lib/test.js' +import { Suite, Test } from 'mocha' import { BeforeHook, AfterHook, BeforeSuiteHook, AfterSuiteHook } from './hooks.js' export { diff --git a/lib/mocha/suite.js b/lib/mocha/suite.js index 2763839fb..014304175 100644 --- a/lib/mocha/suite.js +++ b/lib/mocha/suite.js @@ -1,4 +1,4 @@ -import MochaSuite from 'mocha/lib/suite.js' +import { Suite as MochaSuite } from 'mocha' /** * @typedef {import('mocha')} Mocha */ diff --git a/lib/mocha/test.js b/lib/mocha/test.js index f9f1eb6d1..f85c070ef 100644 --- a/lib/mocha/test.js +++ b/lib/mocha/test.js @@ -1,5 +1,4 @@ -import Test from 'mocha/lib/test.js' -import Suite from 'mocha/lib/suite.js' +import { Suite, Test } from 'mocha' import { genTestId, serializeError, clearString, relativeDir } from '../utils.js' import Step from '../step/base.js' import { enhanceMochaSuite } from './suite.js' diff --git a/lib/mocha/ui.js b/lib/mocha/ui.js index b10c8fba9..ebe747aa1 100644 --- a/lib/mocha/ui.js +++ b/lib/mocha/ui.js @@ -7,7 +7,7 @@ import { createTest } from './test.js' import { createSuite } from './suite.js' import { HookConfig, AfterSuiteHook, AfterHook, BeforeSuiteHook, BeforeHook } from './hooks.js' import { initMochaGlobals } from '../globals.js' -import common from 'mocha/lib/interfaces/common.js' +import { createCommon } from 'mocha/lib/interfaces/common.js' import container from '../container.js' import store from '../store.js' @@ -49,7 +49,7 @@ export default function (suite) { let afterEachHooksAreLoaded suite.on('pre-require', (context, file, mocha) => { - const cmn = common(suites, context, mocha) + const cmn = createCommon(suites, context, mocha) const addScenario = function (title, opts = {}, fn) { const suite = suites[0] @@ -74,7 +74,7 @@ export default function (suite) { context.BeforeAll = cmn.before context.AfterAll = cmn.after - context.run = mocha.options.delay && common.runWithSuite(suite) + context.run = mocha.options.delay && cmn.runWithSuite(suite) /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites diff --git a/package.json b/package.json index 09f96cca8..4cd9facbf 100644 --- a/package.json +++ b/package.json @@ -100,11 +100,11 @@ "@cucumber/gherkin": "38.0.0", "@cucumber/messages": "32.3.1", "@modelcontextprotocol/sdk": "^1.26.0", - "@xmldom/xmldom": "0.9.10", + "@xmldom/xmldom": "^0.9.12", "acorn": "8.15.0", "ai": "7.0.132", "arrify": "3.0.0", - "axios": "1.16.1", + "axios": "^1.20.0", "chalk": "4.1.2", "cheerio": "^1.0.0", "chokidar": "^5.0.0", @@ -127,7 +127,7 @@ "lodash.merge": "4.6.2", "lodash.shuffle": "4.2.0", "mkdirp": "3.0.1", - "mocha": "11.7.5", + "mocha": "^12.0.3", "monocart-coverage-reports": "2.12.12", "ms": "2.1.3", "multer": "^2.0.2", @@ -160,7 +160,7 @@ "@wdio/sauce-service": "9.12.5", "@wdio/selenium-standalone-service": "8.15.0", "@wdio/utils": "9.23.3", - "@xmldom/xmldom": "0.9.10", + "@xmldom/xmldom": "^0.9.12", "bunosh": "latest", "chai": "^6.2.1", "chai-as-promised": "^8.0.2", diff --git a/test/unit/circular_reference_test.js b/test/unit/circular_reference_test.js index 795b95710..62f5664b3 100644 --- a/test/unit/circular_reference_test.js +++ b/test/unit/circular_reference_test.js @@ -2,7 +2,7 @@ import { expect } from 'chai' import { safeStringify, truncateString } from '../../lib/utils.js' import { createTest } from '../../lib/mocha/test.js' import { createSuite } from '../../lib/mocha/suite.js' -import MochaSuite from 'mocha/lib/suite.js' +import { Suite as MochaSuite } from 'mocha' describe('Circular Reference Handling', function () { describe('safeStringify utility', function () { diff --git a/test/unit/data/ui_test.js b/test/unit/data/ui_test.js index ea18e4981..50a3f637a 100644 --- a/test/unit/data/ui_test.js +++ b/test/unit/data/ui_test.js @@ -1,6 +1,6 @@ import { expect } from 'chai' -import Mocha from 'mocha/lib/mocha.js' -import Suite from 'mocha/lib/suite.js' +import Mocha from 'mocha' +import { Suite } from 'mocha' import makeUI from '../../../lib/mocha/ui.js' import addData from '../../../lib/data/context.js' import DataTable from '../../../lib/data/table.js' diff --git a/test/unit/mocha/retry_integration_test.js b/test/unit/mocha/retry_integration_test.js index e4a658ba3..e68fc0b3c 100644 --- a/test/unit/mocha/retry_integration_test.js +++ b/test/unit/mocha/retry_integration_test.js @@ -1,7 +1,7 @@ import { expect } from 'chai' import { createTest } from '../../../lib/mocha/test.js' import { createSuite } from '../../../lib/mocha/suite.js' -import MochaSuite from 'mocha/lib/suite.js' +import { Suite as MochaSuite } from 'mocha' import retryEnhancer from '../../../lib/listener/retryEnhancer.js' import event from '../../../lib/event.js' diff --git a/test/unit/mocha/test_clone_test.js b/test/unit/mocha/test_clone_test.js index 0e5a324b8..04317d10d 100644 --- a/test/unit/mocha/test_clone_test.js +++ b/test/unit/mocha/test_clone_test.js @@ -1,8 +1,8 @@ import { expect } from 'chai' import { createTest, cloneTest } from '../../../lib/mocha/test.js' import { createSuite } from '../../../lib/mocha/suite.js' -import MochaSuite from 'mocha/lib/suite.js' -import Test from 'mocha/lib/test.js' +import { Suite as MochaSuite } from 'mocha' +import { Test } from 'mocha' import retryEnhancer from '../../../lib/listener/retryEnhancer.js' import event from '../../../lib/event.js' diff --git a/test/unit/mocha/ui_test.js b/test/unit/mocha/ui_test.js index 33fc40a5e..edc61e2d3 100644 --- a/test/unit/mocha/ui_test.js +++ b/test/unit/mocha/ui_test.js @@ -1,6 +1,6 @@ import { expect } from 'chai' -import Mocha from 'mocha/lib/mocha.js' -import Suite from 'mocha/lib/suite.js' +import Mocha from 'mocha' +import { Suite } from 'mocha' import { createTest } from '../../../lib/mocha/test.js' import codeceptjs from '../../../lib/index.js' import makeUI from '../../../lib/mocha/ui.js' From c66dd65d5f22a8355aa8907844dc5c03cdca6b2b Mon Sep 17 00:00:00 2001 From: DavertMik Date: Wed, 14 Oct 2026 02:41:35 +0300 Subject: [PATCH 2/2] ci: drop @testomatio/reporter/mocha from test scripts The mocha adapter uses Mocha.utils.inherits, removed in mocha 12. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/webdriver.yml | 2 +- Bunoshfile.js | 26 ++++++++++++------------- package.json | 34 ++++++++++++++++----------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/webdriver.yml b/.github/workflows/webdriver.yml index 031c44c7a..50e191277 100644 --- a/.github/workflows/webdriver.yml +++ b/.github/workflows/webdriver.yml @@ -59,7 +59,7 @@ jobs: SELENIUM_HOST: localhost SELENIUM_PORT: 4444 - name: run unit tests - run: ./node_modules/.bin/mocha test/helper/WebDriver_test.js --exit --reporter @testomatio/reporter/mocha + run: ./node_modules/.bin/mocha test/helper/WebDriver_test.js --exit timeout-minutes: 10 env: SELENIUM_HOST: localhost diff --git a/Bunoshfile.js b/Bunoshfile.js index f3cf66ff2..d29f1df0d 100644 --- a/Bunoshfile.js +++ b/Bunoshfile.js @@ -715,21 +715,21 @@ export async function prettier() { * Run unit tests. */ export async function testUnit() { - await shell`mocha test/unit --recursive --timeout 10000 --reporter @testomatio/reporter/mocha` + await shell`mocha test/unit --recursive --timeout 10000` } /** * Run REST tests. */ export async function testRest() { - await shell`mocha test/rest --recursive --timeout 20000 --reporter @testomatio/reporter/mocha` + await shell`mocha test/rest --recursive --timeout 20000` } /** * Run runner tests. */ export async function testRunner() { - await shell`mocha test/runner --recursive --timeout 10000 --reporter @testomatio/reporter/mocha` + await shell`mocha test/runner --recursive --timeout 10000` } /** @@ -755,28 +755,28 @@ export async function testWithMockServer() { * Run quick Appium tests. */ export async function testAppiumQuick() { - await shell`mocha test/helper/Appium_test.js --grep 'quick' --reporter @testomatio/reporter/mocha` + await shell`mocha test/helper/Appium_test.js --grep 'quick'` } /** * Run the remaining (second) Appium tests. */ export async function testAppiumOther() { - await shell`mocha test/helper/Appium_test.js --grep 'second' --reporter @testomatio/reporter/mocha` + await shell`mocha test/helper/Appium_test.js --grep 'second'` } /** * Run quick iOS Appium tests. */ export async function testIosAppiumQuick() { - await shell`mocha test/helper/Appium_ios_test.js --grep 'quick' --reporter @testomatio/reporter/mocha` + await shell`mocha test/helper/Appium_ios_test.js --grep 'quick'` } /** * Run the remaining (second) iOS Appium tests. */ export async function testIosAppiumOther() { - await shell`mocha test/helper/Appium_ios_test.js --grep 'second' --reporter @testomatio/reporter/mocha` + await shell`mocha test/helper/Appium_ios_test.js --grep 'second'` } /** @@ -797,42 +797,42 @@ export async function testAppStop() { * Run Playwright helper unit tests. */ export async function testWebapiPlaywright() { - await shell`mocha test/helper/Playwright_test.js --reporter @testomatio/reporter/mocha` + await shell`mocha test/helper/Playwright_test.js` } /** * Run Puppeteer helper unit tests. */ export async function testWebapiPuppeteer() { - await shell`mocha test/helper/Puppeteer_test.js --reporter @testomatio/reporter/mocha` + await shell`mocha test/helper/Puppeteer_test.js` } /** * Run WebDriver helper unit tests. */ export async function testWebapiWebdriver() { - await shell`mocha test/helper/WebDriver_test.js --timeout 10000 --reporter @testomatio/reporter/mocha` + await shell`mocha test/helper/WebDriver_test.js --timeout 10000` } /** * Run WebDriver helper unit tests without a Selenium server. */ export async function testWebapiWebdriverNoSelenium() { - await shell`mocha test/helper/WebDriver.noSeleniumServer_test.js --timeout 10000 --reporter @testomatio/reporter/mocha` + await shell`mocha test/helper/WebDriver.noSeleniumServer_test.js --timeout 10000` } /** * Run Expect helper unit tests. */ export async function testExpect() { - await shell`mocha test/helper/Expect_test.js --reporter @testomatio/reporter/mocha` + await shell`mocha test/helper/Expect_test.js` } /** * Run plugin tests. */ export async function testPlugin() { - await shell`mocha test/plugin/plugin_test.js --reporter @testomatio/reporter/mocha` + await shell`mocha test/plugin/plugin_test.js` } /** diff --git a/package.json b/package.json index 4cd9facbf..e4fdc7ddd 100644 --- a/package.json +++ b/package.json @@ -63,26 +63,26 @@ "lint-fix": "eslint bin/ examples/ lib/ test/ translations/ runok.cjs --fix", "prettier": "prettier --config prettier.config.js --write bin/**/*.js lib/**/*.js test/**/*.js translations/**/*.js runok.cjs", "docs": "./runok.cjs docs", - "test:unit": "mocha test/unit --recursive --timeout 10000 --reporter @testomatio/reporter/mocha", - "test:unit:windows": "mocha test/unit/container_test.js --recursive --timeout 10000 --reporter @testomatio/reporter/mocha", - "test:rest": "mocha test/rest --recursive --timeout 20000 --reporter @testomatio/reporter/mocha", - "test:runner": "mocha test/runner --recursive --timeout 10000 --reporter @testomatio/reporter/mocha", + "test:unit": "mocha test/unit --recursive --timeout 10000", + "test:unit:windows": "mocha test/unit/container_test.js --recursive --timeout 10000", + "test:rest": "mocha test/rest --recursive --timeout 20000", + "test:runner": "mocha test/runner --recursive --timeout 10000", "test": "npm run test:unit && npm run test:rest && npm run test:runner", - "test:appium-quick": "mocha test/helper/Appium_test.js --grep 'quick' --reporter @testomatio/reporter/mocha", - "test:appium-other": "mocha test/helper/Appium_test.js --grep 'second' --reporter @testomatio/reporter/mocha", - "test:ios:appium-quick": "mocha test/helper/Appium_ios_test.js --grep 'quick' --reporter @testomatio/reporter/mocha", - "test:ios:appium-other": "mocha test/helper/Appium_ios_test.js --grep 'second' --reporter @testomatio/reporter/mocha", + "test:appium-quick": "mocha test/helper/Appium_test.js --grep 'quick'", + "test:appium-other": "mocha test/helper/Appium_test.js --grep 'second'", + "test:ios:appium-quick": "mocha test/helper/Appium_ios_test.js --grep 'quick'", + "test:ios:appium-other": "mocha test/helper/Appium_ios_test.js --grep 'second'", "test-app:start": "php -S 127.0.0.1:8000 -t test/data/app", "test-app:stop": "kill -9 $(lsof -t -i:8000)", - "test:unit:webbapi:playwright": "mocha test/helper/Playwright_test.js --reporter @testomatio/reporter/mocha", - "test:unit:webbapi:puppeteer": "mocha test/helper/Puppeteer_test.js --reporter @testomatio/reporter/mocha", - "test:unit:webbapi:webDriver": "mocha test/helper/WebDriver_test.js --timeout 10000 --reporter @testomatio/reporter/mocha", - "test:unit:webbapi:webDriver:noSeleniumServer": "mocha test/helper/WebDriver.noSeleniumServer_test.js --timeout 10000 --reporter @testomatio/reporter/mocha", - "test:unit:webbapi:cdpbrowser": "mocha test/helper/CDPBrowser_chrome_test.js --timeout 30000 --reporter @testomatio/reporter/mocha", - "test:unit:webbapi:obscura": "mocha test/helper/CDPBrowser_obscura_test.js --timeout 30000 --reporter @testomatio/reporter/mocha", - "test:unit:webbapi:lightpanda": "mocha test/helper/CDPBrowser_lightpanda_test.js --timeout 30000 --reporter @testomatio/reporter/mocha", - "test:unit:expect": "mocha test/helper/Expect_test.js --reporter @testomatio/reporter/mocha", - "test:plugin": "mocha test/plugin/plugin_test.js --reporter @testomatio/reporter/mocha", + "test:unit:webbapi:playwright": "mocha test/helper/Playwright_test.js", + "test:unit:webbapi:puppeteer": "mocha test/helper/Puppeteer_test.js", + "test:unit:webbapi:webDriver": "mocha test/helper/WebDriver_test.js --timeout 10000", + "test:unit:webbapi:webDriver:noSeleniumServer": "mocha test/helper/WebDriver.noSeleniumServer_test.js --timeout 10000", + "test:unit:webbapi:cdpbrowser": "mocha test/helper/CDPBrowser_chrome_test.js --timeout 30000", + "test:unit:webbapi:obscura": "mocha test/helper/CDPBrowser_obscura_test.js --timeout 30000", + "test:unit:webbapi:lightpanda": "mocha test/helper/CDPBrowser_lightpanda_test.js --timeout 30000", + "test:unit:expect": "mocha test/helper/Expect_test.js", + "test:plugin": "mocha test/plugin/plugin_test.js", "def": "./runok.cjs def", "dev:graphql": "node test/data/graphql/index.js", "publish:site": "./runok.cjs publish:site",