From 191fa02d1b3a265dce334e94d60cf7d3996cfbf5 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Thu, 17 Apr 2025 10:39:15 -0400 Subject: [PATCH] chore: replace mocha.opts with .mocharc.js for packages that are mocha version 6+ (#31518) * chore: replace mocha.opts with .mocharc.js for packages that are mocha version 6+ * move the mocharc file into the package root * fix mocha reporter config location * fix route to reporter-config * store artifacts for unit tests * move cli mocharc file to root of package * remove storing artifacts * remove js extension from errors mocharc --- .gitignore | 1 + cli/.mocharc.js | 6 ++++++ cli/test/mocha.opts | 4 ---- packages/errors/.mocharc.js | 11 +++++++++++ packages/errors/test/mocha.opts | 7 ------- packages/network/.mocharc.js | 9 +++++++++ packages/network/test/mocha.opts | 5 ----- packages/rewriter/package.json | 1 + 8 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 cli/.mocharc.js delete mode 100644 cli/test/mocha.opts create mode 100644 packages/errors/.mocharc.js delete mode 100644 packages/errors/test/mocha.opts create mode 100644 packages/network/.mocharc.js delete mode 100644 packages/network/test/mocha.opts diff --git a/.gitignore b/.gitignore index 5b94219c86..bdba6ab650 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ Cached Theme Material Design.pak packages/data-context/src/**/*.js packages/errors/src/**/*.js packages/errors/test/**/*.js +!packages/errors/test/.mocharc.js # from driver packages/driver/cypress/videos diff --git a/cli/.mocharc.js b/cli/.mocharc.js new file mode 100644 index 0000000000..bc8f0c0bc9 --- /dev/null +++ b/cli/.mocharc.js @@ -0,0 +1,6 @@ +module.exports = { + spec: 'test/**/*_spec.js', + timeout: 10000, + reporter: 'spec', + recursive: true +} \ No newline at end of file diff --git a/cli/test/mocha.opts b/cli/test/mocha.opts deleted file mode 100644 index 602c913856..0000000000 --- a/cli/test/mocha.opts +++ /dev/null @@ -1,4 +0,0 @@ -test/**/*_spec.js ---timeout 10000 ---reporter spec ---recursive diff --git a/packages/errors/.mocharc.js b/packages/errors/.mocharc.js new file mode 100644 index 0000000000..159b3206e1 --- /dev/null +++ b/packages/errors/.mocharc.js @@ -0,0 +1,11 @@ +module.exports = { + spec: 'test/unit/*.ts', + require: '@packages/ts/register', + recursive: true, + extension: ['ts'], + reporter: 'mocha-multi-reporters', + reporterOptions: { + configFile: '../../mocha-reporter-config.json' + }, + exit: true +} \ No newline at end of file diff --git a/packages/errors/test/mocha.opts b/packages/errors/test/mocha.opts deleted file mode 100644 index 6918749269..0000000000 --- a/packages/errors/test/mocha.opts +++ /dev/null @@ -1,7 +0,0 @@ -test/unit --r @packages/ts/register ---recursive ---extension=js,ts ---reporter mocha-multi-reporters ---reporter-options configFile=../../mocha-reporter-config.json ---exit \ No newline at end of file diff --git a/packages/network/.mocharc.js b/packages/network/.mocharc.js new file mode 100644 index 0000000000..1ac5417f66 --- /dev/null +++ b/packages/network/.mocharc.js @@ -0,0 +1,9 @@ +module.exports = { + spec: [ + 'test/unit/**/*.ts', + 'test/integration/**/*.ts' + ], + require: '../web-config/node-register', + timeout: 10000, + recursive: true +} \ No newline at end of file diff --git a/packages/network/test/mocha.opts b/packages/network/test/mocha.opts deleted file mode 100644 index a9c2d9d05d..0000000000 --- a/packages/network/test/mocha.opts +++ /dev/null @@ -1,5 +0,0 @@ -test/unit/**/*.ts -test/integration/**/*.ts ---require ../web-config/node-register ---timeout 10000 ---recursive diff --git a/packages/rewriter/package.json b/packages/rewriter/package.json index 3acdca7d72..72a68a3f19 100644 --- a/packages/rewriter/package.json +++ b/packages/rewriter/package.json @@ -27,6 +27,7 @@ "@cypress/request-promise": "^5.0.0", "@types/parse5-html-rewriting-stream": "5.1.1", "fs-extra": "9.1.0", + "mocha": "3.5.3", "nock": "13.2.9", "sinon": "9.0.2", "sinon-chai": "3.5.0",