2

So when I run npm run test_w_emulator or npm run test_w_pure my mocha test completes properly


package.json

"scripts": {
    "test_w_emulator": "sh ./test.sh",
    "test_w_pure": "mocha --reporter spec"
}

test.sh

firebase -P development emulators:exec "mocha"


if i run it from the command line i get the following error

Exception during run: TypeError: Cannot read properties of undefined (reading 'describe')
    at exports.describe (_____\functions\node_modules\mocha\lib\mocha.js:111:26)
    at Object.<anonymous> (_____\functions\test\auth.test.ts:75:9)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module.m._compile (C:\Users\_____\AppData\Roaming\nvm\v20.18.1\node_modules\ts-node\src\index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Object.require.extensions.<computed> [as .ts] (C:\Users\_____\AppData\Roaming\nvm\v20.18.1\node_modules\ts-node\src\index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.exports.requireOrImport (C:\Users\_____\AppData\Roaming\nvm\v20.18.1\node_modules\mocha\lib\nodejs\esm-utils.js:53:16)
    at async Object.exports.loadFilesAsync (C:\Users\_____\AppData\Roaming\nvm\v20.18.1\node_modules\mocha\lib\nodejs\esm-utils.js:100:20)
    at async singleRun (C:\Users\_____\AppData\Roaming\nvm\v20.18.1\node_modules\mocha\lib\cli\run-helpers.js:162:3)
    at async Object.exports.handler (C:\Users\_____\AppData\Roaming\nvm\v20.18.1\node_modules\mocha\lib\cli\run.js:375:5)

i don't fully understand why the commands work in the context of npm and not straight from the command line

i tried checking my node and java versions making sure they were in the compatibility list of the dependencies

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.