jeudi 25 juillet 2019

Cannot run mocha tests in angular project

I am unable to run mocha test in my angular project and I'm unable to debug what is the reason of that. In package .json I changed "test": "mocha -r ts-node/register src/**/test.ts"

npm test

> reusable-components@0.0.0 test /Users/daro/code/reusable-components
> mocha -r ts-node/register src/**/test.ts

/Users/daro/code/reusable-components/src/test.ts:2
import 'zone.js/dist/zone-testing';
^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Module.m._compile (/Users/daro/code/reusable-components/node_modules/ts-node/src/index.ts:439:23)
    at Module._extensions..js (module.js:663:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/daro/code/reusable-components/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /Users/daro/code/reusable-components/node_modules/mocha/lib/mocha.js:334:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/Users/daro/code/reusable-components/node_modules/mocha/lib/mocha.js:331:14)
    at Mocha.run (/Users/daro/code/reusable-components/node_modules/mocha/lib/mocha.js:811:10)
    at Object.exports.singleRun (/Users/daro/code/reusable-components/node_modules/mocha/lib/cli/run-helpers.js:108:16)
    at exports.runMocha (/Users/daro/code/reusable-components/node_modules/mocha/lib/cli/run-helpers.js:142:13)
    at Object.exports.handler.argv [as handler] (/Users/daro/code/reusable-components/node_modules/mocha/lib/cli/run.js:292:3)
    at Object.runCommand (/Users/daro/code/reusable-components/node_modules/mocha/node_modules/yargs/lib/command.js:242:26)
    at Object.parseArgs [as _parseArgs] (/Users/daro/code/reusable-components/node_modules/mocha/node_modules/yargs/yargs.js:1087:28)
    at Object.parse (/Users/daro/code/reusable-components/node_modules/mocha/node_modules/yargs/yargs.js:566:25)
    at Object.exports.main (/Users/daro/code/reusable-components/node_modules/mocha/lib/cli/cli.js:68:6)
    at Object.<anonymous> (/Users/daro/code/reusable-components/node_modules/mocha/bin/mocha:154:29)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
npm ERR! Test failed.  See above for more details.

Aucun commentaire:

Enregistrer un commentaire