question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

windows drive letter casing bug

See original GitHub issue

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_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.

Description

Tests fail when drive letter is lower case.

Steps to Reproduce

repro.zip

npm install
node index.js

Expected behavior: [What you expect to happen]

Test should pass and print:

 √ Lean3 project

Actual behavior: [What actually happens]

Tests fail with this error:

TypeError: Cannot read properties of undefined (reading 'describe')

Reproduces how often: [What percentage of the time does it reproduce?]

100%

Versions

  • The output of mocha --version and node_modules/.bin/mocha --version: 8.4.0
  • The output of node --version: v16.14.0
  • Your operating system
    • name and version: Windows 11 21H2 build 22000.588
    • architecture (32 or 64-bit): 64-bit
  • Your shell (e.g., bash, zsh, PowerShell, cmd): cmd
  • Your browser and version (if running browser tests): running vscode tests using VS code 1.65.2.
  • Any third-party Mocha-related modules (and their versions): N/A
  • Any code transpiler (e.g., TypeScript, CoffeeScript, Babel) being used (and its version): Typescript.

Additional Information

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Alvarofgcommented, Apr 3, 2022

I think I’m getting an issue that might be related:

this works as expected: node ".\node_modules\mocha\bin\_mocha" -u tdd --timeout 999999 --colors D:\repo\test

this doesn’t work: node ".\node_modules\mocha\bin\_mocha" -u tdd --timeout 999999 --colors d:\repo\test

Error message: TypeError: Cannot read property 'describe' of undefined at exports.describe (d:\repo\node_modules\mocha\lib\mocha.js:112:26) at file:///d:/repo/test/testfile.js:5:1 at ModuleJob.run (internal/modules/esm/module_job.js:169:25) at async Loader.import (internal/modules/esm/loader.js:177:24) at async formattedImport (D:\repo\node_modules\mocha\lib\nodejs\esm-utils.js:7:14) at async Object.exports.requireOrImport (D:\repo\node_modules\mocha\lib\nodejs\esm-utils.js:48:32) at async Object.exports.loadFilesAsync (D:\repo\node_modules\mocha\lib\nodejs\esm-utils.js:103:20) at async singleRun (D:\repo\node_modules\mocha\lib\cli\run-helpers.js:125:3) at async Object.exports.handler (D:\repo\node_modules\mocha\lib\cli\run.js:374:5)

the only difference is the capitalization of the D/d drive. I notice the capitalization changes in the error message. I’m using windows 10

edit: This is probably my fault here, my test file was something like this: const Mocha = require("mocha"); Mocha.describe("#repro", function () { //... })

changing it to: const Mocha = require("mocha"); const mocha = new Mocha({ ui: 'bdd' }); describe("#repro", function () { })

since to render it case insensitive after changing the command to node ".\node_modules\mocha\bin\_mocha" -u bdd --timeout 999999 --colors d:\repo\test

(bdd instead of tdd)

0reactions
juergbacommented, Apr 5, 2022

edit: This is probably my fault here, my test file was something like this: […]

Yep looks like what I’m getting also.

Perfect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows drive letter case different between ... - GitHub
Windows drive letter case different between ${workspaceFolder} and ... The path in the terminal window uses a capital "D".
Read more >
Drive letters on Windows must be Upper case - Bug
The thing is that using lower case drive letters on windows when setting the MGEAR_SHIFTER_CUSTOMSTEP_PATH variable breaks the paths.
Read more >
Indirect bug from lowercase drive letters on Windows
In most cases, it does not matter whether the drive letter is lowercase or uppercase. Still this example shows, there are exceptional cases...
Read more >
Windows 10 - Bug - Drive Letter Assignment
I've recently noticed a strange behavior. Scenario: I have three physical drives (C/D/E); I have four mapped network drives (F/J/S/V).
Read more >
Invalid casing in Windows drive letter with Yarn and NextJS
Upon start-up, I get an error that the casing is "invalid" for my project directory. Specifically, I am seeing the following errors: Invalid ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found