freeCodeCamp: Test fails on "Only change the first line"

Challenge subtract-one-number-from-another-with-javascript has an issue. User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36. Please describe how to reproduce this issue, and include links to screenshots if possible. This fails due to the difference in lines even if code has not been changed. It also fails when changing 0 to 33.



var difference = 45 - 0;



screen shot 2017-02-03 at 1 00 14 am screen shot 2017-02-03 at 12 59 49 am

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 23 (14 by maintainers)

Commits related to this issue

Most upvoted comments

@erictleung It makes sense, then let’s make it 3 and add this test case to addition, multiplication and division challenges.

This issue stems probably because the “solution” in the .json file is included in the code the regex checks (see similar discussion https://github.com/freeCodeCamp/freeCodeCamp/pull/11987#discussion_r92950694). The code is to check that you don’t just create another variable difference and assign it to 12. So I think it’s necessary. Just need to either remove the solution or change the test to check for two instances.

@dnahol The previous challenge, Add Two Numbers, doesn’t have a test case like this one. These two challenges look like very similar. I think it’s ok.