1- "use strict" ;
2-
31/**
42 * Definition for Mocha's default ("run tests") command
53 *
64 * @module
75 * @private
86 */
97
10- const pc = require ( "picocolors" ) ;
11- const Mocha = require ( "../mocha" ) ;
12- const {
8+ import pc from "picocolors" ;
9+ import Mocha from "../mocha.js" ;
10+ import {
1311 createUnsupportedError ,
1412 createInvalidArgumentValueError ,
1513 createMissingArgumentError ,
16- } = require ( "../errors.mjs" ) ;
14+ } from "../errors.mjs" ;
15+
16+ import runHelpers from "./run-helpers.js" ;
17+ import { ONE_AND_DONES , ONE_AND_DONE_ARGS } from "./one-and-dones.mjs" ;
18+ import debugModule from "debug" ;
19+ import defaults from "../mocharc.json" with { type : "json" } ;
20+ import { types , aliases } from "./run-option-metadata.mjs" ;
21+ import utils from "../utils.js" ;
1722
18- const {
19- list,
20- handleRequires,
21- validateLegacyPlugin,
22- runMocha,
23- } = require ( "./run-helpers" ) ;
24- const { ONE_AND_DONES , ONE_AND_DONE_ARGS } = require ( "./one-and-dones.mjs" ) ;
25- const debug = require ( "debug" ) ( "mocha:cli:run" ) ;
26- const defaults = require ( "../mocharc.json" ) ;
27- const { types, aliases } = require ( "./run-option-metadata.mjs" ) ;
28- const { isCI, logSymbols } = require ( "../utils" ) ;
23+ const { list, handleRequires, validateLegacyPlugin, runMocha } = runHelpers ;
24+ const { isCI, logSymbols } = utils ;
25+ const debug = debugModule ( "mocha:cli:run" ) ;
2926
3027/**
3128 * Logical option groups
@@ -40,11 +37,11 @@ const GROUPS = {
4037 CONFIG : "Configuration" ,
4138} ;
4239
43- exports . command = [ "$0 [spec..]" , "inspect" ] ;
40+ export const command = [ "$0 [spec..]" , "inspect" ] ;
4441
45- exports . describe = "Run tests with Mocha" ;
42+ export const describe = "Run tests with Mocha" ;
4643
47- exports . builder = ( yargs ) =>
44+ export const builder = ( yargs ) =>
4845 yargs
4946 . options ( {
5047 "allow-uncaught" : {
@@ -368,7 +365,7 @@ exports.builder = (yargs) =>
368365 . number ( types . number )
369366 . alias ( aliases ) ;
370367
371- exports . handler = async function ( argv ) {
368+ export async function handler ( argv ) {
372369 debug ( "post-yargs config" , argv ) ;
373370 const mocha = new Mocha ( argv ) ;
374371
@@ -378,4 +375,4 @@ exports.handler = async function (argv) {
378375 console . error ( "\n Exception during run:" , err ) ;
379376 process . exit ( 1 ) ;
380377 }
381- } ;
378+ }
0 commit comments