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.

[learn] tests should fail when code has error

See original GitHub issue

I entered a valid solution and passed all the tests in the picture below. Then I added the a on the second line: var collection = { a - to make the build fail, but all the test results still have the green check mark like they passed. I think they should go back to failed if there’s an error.

Screen Shot 2019-05-08 at 8 54 04 AM

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ojeytonwilliamscommented, May 11, 2019

@Stevo99 As Mrugesh said on Gitter, the codebase is a bit complex. The bit responsible for updating the test results is https://github.com/freeCodeCamp/freeCodeCamp/blob/1c669fd56838b68710062bc09f6e4af34e7cf709/client/src/templates/Challenges/redux/execute-challenge-saga.js#L56-L61 and you can see that if there’s an error (which is the case we’re looking at) only the console gets updated, not the tests.

One approach would be to look at the code in https://github.com/freeCodeCamp/freeCodeCamp/blob/1c669fd56838b68710062bc09f6e4af34e7cf709/client/src/templates/Challenges/redux/execute-challenge-saga.js#L82 for inspiration and try to figure out a way to update the tests so they all show as failing.

0reactions
Sfaillacommented, May 18, 2019

It’s better to set an initial state for tests at the beginning

@ValeraS So a few of the Team Members said that your suggestion is the best way to fix this issue. I’m not that experienced with this codebase and I was just wondering if maybe you can explain how I can go about setting an initial state for the tests. I tried to figure it out myself but could not unfortunately. Any help would be appreciated. Thanks!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cause tests to fail when error is thrown after test has completed
I'm trying to find a way to make sure none of my jest tests are throwing errors from an async function. For instance...
Read more >
The Difference Between Failure and Error in JUnit | Baeldung
In short, failures are unfulfilled assertions while errors are due to abnormal test execution. 2. Sample Code. Let's consider a very simplistic ...
Read more >
Testing a trigger that is suppose to cover an failed check
Reaching that deliberately failing assertion means in this case that the error text wasn't added to the record because of the missing gender....
Read more >
Django Tutorial Part 10: Testing a Django web application
Because they are fast, automated tests can be executed more regularly, and if a test fails, they point to exactly where code is...
Read more >
Testing Best Practices - LearnHowToProgram.com
The tests we write always need to be a source of truth. We always need to write a test so that it passes....
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