JSRemoveComments Causing Test to Fail
See original GitHub issueThis code fails one particular test:
const squareList = (arr) => {
// Only change code below this line
return arr
.filter(num => num > 0 && Number.isInteger(num))
.map(num => Math.pow(num, 2));
// Only change code above this line
};
const squaredIntegers = squareList([-3, 4.8, 5, 3, -3.2]);
console.log(squaredIntegers);
Whereas, if the spaces to the left of .map
or .filter
are removed, the code passes.
Helper Function: https://github.com/freeCodeCamp/freeCodeCamp/blob/master/client/src/utils/curriculum-helpers.js
@RandellDawson pinging
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Comments in test file throws exception when writing inline ...
Bug Report When a test file has comments has empty toMatchInlineSnapshot() Running jest will fail when prettier tries to prettify the file ...
Read more >How to strip comments in javascript? - node.js - Stack Overflow
I think strip comment is not working because it takes string as an argument but fs.readFileSync doesn't return string. I have also tried...
Read more >Code Review: Please Remove Comments From Your Code
These days, I usually ask other people to remove mostly all their comments in code review. This post will talk about the reason...
Read more >Is there a method for differentiating informative comments from ...
There is a very simple solution to this: remove the commented-out code. Really, there are only two good reasons to comment out code:...
Read more >Ticket: Create/ Update/ Delete comments - M220JS - MongoDB
I m stuck on the Update and Delete comments ticket. I believe my code is correct and I am passing 2/3 tests, however,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I thought the reason is to resolve this issue -
removeJSComments
by itself causes unwanted formatting.But I have just thought of why removing whitespace is not the best solution, because JS keywords rely on whitespace for delimanation. Probably works for most tests, but can cause other issues down the line.
I am going to close this, for now.
Reason: The specific challenge mentioned does not experience this, anymore, and is/was AFAIK the only one experiencing any issue with
removeJSComments
. So, unless this pops up again in new challenges, nothing will need to be done here.