Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"utils.files is not a function" (mocha: 5.0.2) #3265

Closed
5c077yP opened this issue Mar 6, 2018 · 8 comments · Fixed by #3268
Closed

"utils.files is not a function" (mocha: 5.0.2) #3265

5c077yP opened this issue Mar 6, 2018 · 8 comments · Fixed by #3268

Comments

@5c077yP
Copy link

5c077yP commented Mar 6, 2018

Description

Hey, i've just upgraded to the latest mocha version 5.0.2 and I now start to see a "utils.files is not a function" error when running in watch mode with passing a glob path. Seems this commit ec8901a removed the function which is still used in https://github.com/mochajs/mocha/blob/master/bin/_mocha#L532

Steps to Reproduce

NODE_ENV=test mocha './test/**/*.js'

Expected behavior:

it should execute my tests as before.

Actual behavior:

it crashes all the time

> NODE_ENV=test mocha './test/**/*.js' "--watch"

/opt/MY-PACKAGE/node_modules/mocha/bin/_mocha:532
  const watchFiles = utils.files(cwd, [ 'js' ].concat(program.watchExtensions));
                           ^

TypeError: utils.files is not a function
    at Object.<anonymous> (/opt/MY-PACKAGE/node_modules/mocha/bin/_mocha:532:28)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

Versions

  • 5.0.2
  • shell: zsh
  • The code transpiler being used: babel
@5c077yP 5c077yP changed the title "utils.files is not a function" "utils.files is not a function" (mocha: 5.0.2) Mar 6, 2018
@remolueoend
Copy link

remolueoend commented Mar 6, 2018

Same here, looks like utils.files was removed in ec8901a but is still in use at https://github.com/mochajs/mocha/blob/master/bin/_mocha#L532.

@archae0pteryx
Copy link

This exists in 5.0.1 as well it seems.

@arichiardi
Copy link

Confirm this is still an issue.

@ihsw
Copy link

ihsw commented Mar 7, 2018

Downgraded to 5.0.1, it works.

@sebs
Copy link

sebs commented May 9, 2018

Error exists in 5.11, node 9.5.0 as well
Downgrade to 5.0.0 fixed it.

@sebs
Copy link

sebs commented May 9, 2018

Please reopen.

@boneskull
Copy link
Member

@sebs This has already been fixed; please check that the mocha you are executing is indeed v5.1.1; you may need to run mocha -v. sometimes a globally-installed mocha is used by mistake

@sebs
Copy link

sebs commented May 10, 2018

Ah I donnu, I was so sure I had pinned it down to 5.1.1 Mocha works as intended
Thanks

@mochajs mochajs locked as resolved and limited conversation to collaborators May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants