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
This commit is contained in:
Jennifer Shehane
2025-04-17 10:39:15 -04:00
committed by GitHub
parent a50012b892
commit 191fa02d1b
8 changed files with 28 additions and 16 deletions

1
.gitignore vendored
View File

@@ -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

6
cli/.mocharc.js Normal file
View File

@@ -0,0 +1,6 @@
module.exports = {
spec: 'test/**/*_spec.js',
timeout: 10000,
reporter: 'spec',
recursive: true
}

View File

@@ -1,4 +0,0 @@
test/**/*_spec.js
--timeout 10000
--reporter spec
--recursive

View File

@@ -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
}

View File

@@ -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

View File

@@ -0,0 +1,9 @@
module.exports = {
spec: [
'test/unit/**/*.ts',
'test/integration/**/*.ts'
],
require: '../web-config/node-register',
timeout: 10000,
recursive: true
}

View File

@@ -1,5 +0,0 @@
test/unit/**/*.ts
test/integration/**/*.ts
--require ../web-config/node-register
--timeout 10000
--recursive

View File

@@ -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",