Skip to content

Commit

Permalink
Support for Mocha 9 (#124)
Browse files Browse the repository at this point in the history
* Upgrades yarn version

* Support for mocha 9
  • Loading branch information
BeeMargarida authored Jan 25, 2022
1 parent a678c17 commit d76c8a5
Show file tree
Hide file tree
Showing 6 changed files with 1,465 additions and 1,353 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"author": "Victor Vlasenko <victor.vlasenko@sysgears.com>",
"license": "MIT",
"peerDependencies": {
"mocha": ">=6 <9",
"mocha": ">=6",
"webpack": "^4.0.0 || ^5.0.0"
},
"devDependencies": {
Expand All @@ -60,7 +60,7 @@
"@babel/runtime": "^7.7.6",
"@types/chai": "^4.2.7",
"@types/lodash": "^4.14.149",
"@types/mocha": "^5.2.7",
"@types/mocha": "^9.1.0",
"@types/node": "^12.12.17",
"@types/sinon": "^9.0.0",
"@types/sinon-chai": "^3.2.4",
Expand Down Expand Up @@ -94,7 +94,7 @@
"gitbook-plugin-github": "^2.0.0",
"gitbook-plugin-prism": "^2.0.0",
"glob": "7.1.4",
"mocha": "7.1.1",
"mocha": "9.2.0",
"node-sass": "^4.11.0",
"np": "5.1.0",
"nyc": "14.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ const translateObjectIntoMochaOptions = (
}
)

const mochaOptions = ensureNumericOptionsAreNumbers<MochaOptions>(options)
if (mochaOptions.timeout === 0) mochaOptions.enableTimeouts = false

return mochaOptions
return ensureNumericOptionsAreNumbers<MochaOptions>(options)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe('optionsFromParsedArgs', () => {
argName: 'timeout',
optionName: 'timeout',
providedArgs: { timeout: '0' },
expectedOptions: { timeout: 0, enableTimeouts: false }
expectedOptions: { timeout: 0 }
},
{
argName: 'ui',
Expand Down
2 changes: 0 additions & 2 deletions src/runner/TestRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type MochaRunner = {
abort: () => void
currentRunnable?: {
retries: (count: number) => void
enableTimeouts: (enabled: boolean) => void
timeout: (ms: number) => void
resetTimeout: (ms: number) => void
}
Expand Down Expand Up @@ -214,7 +213,6 @@ export default class TestRunner extends EventEmitter {
if (mochaRunner.currentRunnable) {
const runnable = mochaRunner.currentRunnable
runnable.retries(0)
runnable.enableTimeouts(true)
runnable.timeout(1)
runnable.resetTimeout(1)
}
Expand Down
5 changes: 0 additions & 5 deletions src/runner/runnerUtils/initMocha/initMocha.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@ describe('initMocha', async () => {
providedOptions: { constructor: { delay: true } },
expectedMochaOptions: { delay: true }
},
{
optionName: 'enableTimeouts',
providedOptions: { constructor: { enableTimeouts: true } },
expectedMochaOptions: { enableTimeouts: true }
},
{
optionName: 'forbidOnly',
providedOptions: { constructor: { forbidOnly: true } },
Expand Down
Loading

0 comments on commit d76c8a5

Please sign in to comment.