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.

Error in unit tests

See original GitHub issue

After creating a project with this template, the tests don’t run:

$ npm test

> chatbot@1.1.0 test /project
> jest

 FAIL  tests/handler.test.js
  ● Test suite failed to run

    /project/tests/handler.test.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import * as handler from '../handler';
                                                                                             ^^^^^^

    SyntaxError: Unexpected token import

      at new Script (vm.js:51:7)
          at Generator.next (<anonymous>)
          at new Promise (<anonymous>)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.531s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
thghcommented, Mar 28, 2018

I think I messed up the .babelrc file. Works fine now 😀

This project looks promising, will try it out next time!

0reactions
jayaircommented, Apr 30, 2018

@jeff-kilbride I see. Thanks for reporting back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unit Testing Error Handling and Exceptions
One of the things that unit tests are best for is checking error conditions. While we want wider coverage of full happy flows,...
Read more >
How do you test that a Python function throws an exception?
The unittest function assertRaises only checks if an exception was raised. This seems overly complicated for testing if a function throws an exception....
Read more >
Should unit tests check for error conditions?
Should a unit test incorporate tests for error conditions? For example, what if the database connection fails? Remember that the line by line...
Read more >
Top 5 Mistakes You're Probably Making While Unit Testing ...
The key to unit testing is the word “unit”. First and foremost, your tests should be testing a unit of code. And what...
Read more >
4 common mistakes when writing your first unit tests
4 common mistakes when writing your first unit tests · Mistake 1: Do not follow a naming convention · Mistake 2: Do not...
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