Sto usando Mocha per i miei test NodeJS e quando un test fallisce a causa di un errore generato dal mio codice sorgente (ad esempio "TypeError: Cannot read property 'prop' of null
"), i numeri di riga nello stacktrace visualizzato sono errati (non corrispondono a il file sorgente originale, ma sono molto più grandi).Come rendere Mocha visualizzare i numeri di riga corretti nei file sorgente se un test fallisce?
1) MyApp should do something:
TypeError: Cannot read property 'prop' of null
at MyApp.<anonymous> (/path/to/my-project/lib/my-project.js:515:93)
at MyApp.build (/path/to/my-project/lib/my-project.js:774:16)
at Context.<anonymous> (/path/to/my-project/test/test.js:62:67)
at Test.Runnable.run (/path/to/my-project/node_modules/mocha/lib/runnable.js:216:15)
at Runner.runTest (/path/to/my-project/node_modules/mocha/lib/runner.js:373:10)
at /path/to/my-project/node_modules/mocha/lib/runner.js:451:12
at next (/path/to/my-project/node_modules/mocha/lib/runner.js:298:14)
at /path/to/my-project/node_modules/mocha/lib/runner.js:308:7
at next (/path/to/my-project/node_modules/mocha/lib/runner.js:246:23)
at Object._onImmediate (/path/to/my-project/node_modules/mocha/lib/runner.js:275:5)
at processImmediate [as _immediateCallback] (timers.js:330:15)
(Qui my-project.js
ha solo 279 linee!)
C'è un modo per dire Mocha per visualizzare correttamente?
Sei riuscito a risolvere questo problema? Sto ancora avendo lo stesso problema anche con le ultime versioni di node/mocha. –
No, scusa, ho ancora questo errore ... –