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.

"npm test" is reporting errors in console

See original GitHub issue

Describe the bug Execute:

  • npm install
  • npm test

Tests are green but there are errors in the console:

SyntaxError: Invalid or unexpected token at new Script (vm.js:79:7) at ScriptTransformer._transformAndBuildScript (C:\Users\jbiehler\Git\opendrinks\node_modules\jest-runtime\build\script_transformer.js:403:17) at ScriptTransformer.transform (C:\Users\jbiehler\Git\opendrinks\node_modules\jest-runtime\build\script_transformer.js:448:19) at Runtime._execModule (C:\Users\jbiehler\Git\opendrinks\node_modules\jest-runtime\build\index.js:640:53) at Runtime.requireModule (C:\Users\jbiehler\Git\opendrinks\node_modules\jest-runtime\build\index.js:376:14) at Runtime.requireModuleOrMock (C:\Users\jbiehler\Git\opendrinks\node_modules\jest-runtime\build\index.js:463:19) at require (C:\Users\jbiehler\Git\opendrinks\src\recipes\index.js:35:14) at getRecipe (C:\Users\jbiehler\Git\opendrinks\src\recipes\index.js:48:86) at func (C:\Users\jbiehler\Git\opendrinks\src\recipes\index.js:5:43) at Array.map (<anonymous>)

This was tested with the current master branch.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
gabberseppcommented, Oct 14, 2019

@alfg you are right. I did not have seen the config for jest-transform-stub. Works now after adding “jpeg” to the regex, too. So I removed the other code.

0reactions
alfgcommented, Oct 14, 2019

I can’t check right now, but can you try adding jpeg to the regex on: https://github.com/alfg/opendrinks/blob/master/jest.config.js#L5

Read more comments on GitHub >

github_iconTop Results From Across the Web

When executing npm test, it will report an error randomly ...
Error message: console.log test/mocks/store.ts:14 i am in mockstore console.log test/specs/edit/ccc.spec.js:26
Read more >
node.js - How to see stacktrace / cause of an error in Jest?
I have to put a try/catch around the code inside every test and console.log the errors. – dcsan. May 1 at 8:58. Hey ......
Read more >
Testing Error Handling in node.js | by Lars Trieloff
--reporter=text creates a nice textual summary at the end of every npm test run that shows files and lines that are not properly...
Read more >
error-logging - npm search
ps-logger is a production grade logger, basically it is used for logging info,warning,error,silly,verbose and debug statements.
Read more >
Setting Up Error Reporting for Node.js - Google Cloud
New customers also get $300 in free credits to run, test, and deploy workloads. In the Google Cloud console, on the project selector...
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