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.

Tests for various challenges are too strict about whitespace around function arguments

See original GitHub issue

The 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:

svg
      .append( 'g' )
      .attr(
        'transform',
        `translate(${padding}, 0)`
      )
      .call( yAxis );
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:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nikrbcommented, Feb 18, 2019

@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.

1reaction
wmollenkopfcommented, Nov 23, 2018

I hope it was okay, but I went ahead and created a RegExp instead of a pure string compare for the assertion.

Read more comments on GitHub >

github_iconTop 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 >

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