Hello!
I am trying to figure out how to run my tests I’ve written for the Personal Library Project. You can see my code on GLITCH. from what I’ve read about Mocha/Chai testing I should be able to npm test
in the terminal, but Mocha by default expects tests to be in the src/test directory and this project is setup differently by default. I assume I need to write a custom script for test
and add it to my package.json file, but I’m not 100% certain of what to write. My code has my attempt at it, but it’s not running the test file. Any help is greatly appreciated and I get an error about suite not being defined.
/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/yargs/13.3.0/node_modules/yargs/yargs.js:1163
else throw err
^
ReferenceError: suite is not defined
at Object.<anonymous> (/app/tests/2_functional-tests.js:8:1)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at /rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/mocha/7.0.0/node_modules/mocha/lib/mocha.js:308:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/mocha/7.0.0/node_modules/mocha/lib/mocha.js:305:14)
at Mocha.run (/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/mocha/7.0.0/node_modules/mocha/lib/mocha.js:846:10)
at Object.exports.singleRun (/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/mocha/7.0.0/node_modules/mocha/lib/cli/run-helpers.js:108:16)
at exports.runMocha (/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/mocha/7.0.0/node_modules/mocha/lib/cli/run-helpers.js:143:13)
at Object.exports.handler.argv [as handler] (/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/mocha/7.0.0/node_modules/mocha/lib/cli/run.js:305:3)
at Object.runCommand (/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/yargs/13.3.0/node_modules/yargs/lib/command.js:242:26)
at Object.parseArgs [as _parseArgs] (/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/yargs/13.3.0/node_modules/yargs/yargs.js:1087:28)
at Object.parse (/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/yargs/13.3.0/node_modules/yargs/yargs.js:566:25)
at Object.exports.main (/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/mocha/7.0.0/node_modules/mocha/lib/cli/cli.js:68:6)
at Object.<anonymous> (/rbd/pnpm-volume/f50952e1-dd1b-4236-946b-2f27c2a19236/node_modules/.registry.npmjs.org/mocha/7.0.0/node_modules/mocha/bin/mocha:133:29)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! Test failed. See above for more details.