Skip to content

Commit

Permalink
Support for mocha 8.2.0 validateLegacyPlugin change (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ana Margarida Silva authored Oct 20, 2020
1 parent a852796 commit 6954bed
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/cli/argsParser/parseArgv/mocha/parseMochaArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createUnsupportedError
} from 'mocha/lib/errors'
import { ONE_AND_DONES } from 'mocha/lib/cli/one-and-dones'
import { handleRequires, validatePlugin } from 'mocha/lib/cli/run-helpers'
import { handleRequires, validatePlugin, validateLegacyPlugin } from 'mocha/lib/cli/run-helpers'
import { aliases, types } from 'mocha/lib/cli/run-option-metadata'
import yargs, { Arguments } from 'yargs'

Expand Down Expand Up @@ -52,8 +52,16 @@ const mochaChecks = (yargsInstance: any, argv: Arguments) => {

// load requires first, because it can impact "plugin" validation
handleRequires(argv.require)
validatePlugin(argv, 'reporter', Mocha.reporters)
validatePlugin(argv, 'ui', Mocha.interfaces)

// necessary since mocha 8.2.0 version
if (validatePlugin) {
validatePlugin(argv, 'reporter', Mocha.reporters)
validatePlugin(argv, 'ui', Mocha.interfaces)
}
else {
validateLegacyPlugin(argv, 'reporter', Mocha.reporters)
validateLegacyPlugin(argv, 'ui', Mocha.interfaces)
}

return true
}
Expand Down

0 comments on commit 6954bed

Please sign in to comment.