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

Configuring spec = '<glob>' fails #4656

Closed
4 tasks done
jginsburgn opened this issue Jun 10, 2021 · 2 comments
Closed
4 tasks done

Configuring spec = '<glob>' fails #4656

jginsburgn opened this issue Jun 10, 2021 · 2 comments
Labels
invalid not something we need to work on, such as a non-reproducing issue or an external root cause

Comments

@jginsburgn
Copy link

jginsburgn commented Jun 10, 2021

Prerequisites

  • Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.

Description

Asking Mocha to do the work of globbing spec files fails. This makes working without globstar very hard; some CI tools that we use do not allow turning on globstar on the environment shell.

Steps to Reproduce

git clone https://github.com/jginsburgn/mocha-seed.git
cd mocha-seed
git checkout mocha-globbing-bug
npm install
npm test

Expected behavior: [What you expect to happen]

The test to be ran correctly.

Actual behavior: [What actually happens]

npm WARN mocha-seed@0.0.0 No repository field.

added 93 packages from 52 contributors and audited 93 packages in 0.833s

19 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


> mocha-seed@0.0.0 test /Users/jginsburgn/repos/mocha-seed
> mocha

[
  0.9,   1, 1.1, 2.9,
    3, 3.1, 4.9,   5,
  5.1
]

Error: Cannot find module 'tape'
Require stack:
- /Users/jginsburgn/repos/mocha-seed/node_modules/concat-map/test/map.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/jginsburgn/repos/mocha-seed/node_modules/concat-map/test/map.js:2:12)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at ModuleWrap.<anonymous> (internal/modules/esm/translators.js:195:29)
    at ModuleJob.run (internal/modules/esm/module_job.js:145:37)
    at async Loader.import (internal/modules/esm/loader.js:182:24)
    at async formattedImport (/Users/jginsburgn/repos/mocha-seed/node_modules/mocha/lib/esm-utils.js:7:14)
    at async Object.exports.requireOrImport (/Users/jginsburgn/repos/mocha-seed/node_modules/mocha/lib/esm-utils.js:46:32)
    at async Object.exports.loadFilesAsync (/Users/jginsburgn/repos/mocha-seed/node_modules/mocha/lib/esm-utils.js:71:20)
    at async singleRun (/Users/jginsburgn/repos/mocha-seed/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async Object.exports.handler (/Users/jginsburgn/repos/mocha-seed/node_modules/mocha/lib/cli/run.js:366:5)

Reproduces how often: 100%

Versions

  • The output of mocha --version and node node_modules/.bin/mocha --version: 9.0.0
  • The output of node --version: v12.22.1
  • Your operating system
    • name and version: macOS
    • architecture (32 or 64-bit): 11.4
  • Your shell (e.g., bash, zsh, PowerShell, cmd): bash
  • Your browser and version (if running browser tests): -
  • Any third-party Mocha-related modules (and their versions): -
  • Any code transpiler (e.g., TypeScript, CoffeeScript, Babel) being used (and its version): -
@juergba
Copy link
Contributor

juergba commented Jun 10, 2021

/Users/jginsburgn/repos/mocha-seed/node_modules/concat-map/test/map.js

With your glob your are trying to execute the tests of concat-map package, incl. of all other packages in the node_modules folder.
Your glob doesn't make sense.

Change your glob to "spec": "./*.js" or put your tests in a test subfolder.

@juergba juergba added invalid not something we need to work on, such as a non-reproducing issue or an external root cause and removed unconfirmed-bug labels Jun 10, 2021
@juergba juergba closed this as completed Jun 10, 2021
@jginsburgn
Copy link
Author

jginsburgn commented Jun 10, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid not something we need to work on, such as a non-reproducing issue or an external root cause
Projects
None yet
Development

No branches or pull requests

2 participants