Tests for various challenges are too strict about whitespace around function arguments
See original GitHub issueThe problem
In the “React and Redux: Moving Forward From Here” challenge, I tried the following code:
console.log( 'Now I know React and Redux!' );
However, this code did not pass the tests. But if I simply remove the spaces, it passes:
console.log('Now I know React and Redux!');
I think the tests for this challenge need to be less strict on spacing. Perhaps a partial minifier could be run on the code to remove excess whitespace within lines before making the test comparison?
This same kind of issue also affects the following challenges:
- “Data Visualization with D3: Add Axes to a Visualization”: spaces are not allowed around
call
method.
svg
.append( 'g' )
.attr(
'transform',
`translate(${padding}, 0)`
)
.call( yAxis );
- “JSON APIs and Ajax: Get JSON with the JavaScript XMLHttpRequest Method”: spaces not allowed around
JSON.parse
arguments.
const apiRequest = new XMLHttpRequest();
apiRequest.open( 'GET', '/json/cats.json', true );
apiRequest.send();
apiRequest.onload = function() {
const json = JSON.parse( apiRequest.responseText );
document.getElementsByClassName( 'message' )[0].innerHTML = JSON.stringify( json );
};
Browser and OS info
- Browser Name: Firefox Developer Edition
- Browser Version: 66.0b5
- Operating System: Antergos Linux
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
no-multi-spaces - ESLint - Pluggable JavaScript Linter
This rule aims to disallow multiple whitespace around logical expressions, conditional expressions, declarations, array elements, object properties, ...
Read more >Formatting - Coding Style - Read the Docs
The open parenthesis is always on the same line as the function name. There is never a space between the function name and...
Read more >PEP 8 – Style Guide for Python Code
Many projects have their own coding style guidelines. ... var_four) # Add 4 spaces (an extra level of indentation) to distinguish arguments ......
Read more >Defining Your Own Python Function
In this tutorial, you'll learn how to define and call your own Python function. You'll also learn about passing data to your function,...
Read more >Why the common practice of writing lines of code without white ...
I prefer to use some white space, but NEVER between a function and the parens in a function call. So I would eliminate...
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
@RandellDawson yes I have to agree … got carried away trying to trim down the
testString
’s. I’ll have a think about a global stripWhiteSpace function.I hope it was okay, but I went ahead and created a RegExp instead of a pure string compare for the assertion.