Confusing instructions for "ES6: Understand the Differences Between import and require" path
Describe the bug
A challenge "Note" indicates that "In most cases, the file path requires a ./ before it; otherwise, node will look in the node_modules directory first trying to load it as a dependency."
Furthermore, the challenge instructions state that "The file where this function lives is called "string_functions", and it is in the same directory as the current file."
Therefore, users should expect the/a correct answer involves "./string_functions".
However, including ./ before the file name causes the challenge to fail.
To Reproduce
- Go to 'https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/understand-the-differences-between-import-and-require'
- Enter
import { capitalizeString } from "./string_functions";below"use strict"; - The challenge fails with a
Cannot read property 'capitalizeString' of undefinederror. - Replace the previous entry with
import { capitalizeString } from "string_functions"; - The challenge passes.
Expected behavior
The challenge should pass when the user includes ./ in front of the imported filename. Or, the challenge should specify that the "string_functions" file lives in the node_modules directory or that no ./ is needed in this challenge.
Screenshots

Desktop (please complete the following information):
- OS: Debian buster/sid
- Browser Brave
- Version 0.23.19-1
Additional context Subsequent ES6 challenges share this problem, but I will hold on filing issues for them until this one is resolved.
Another nit pick, "node" should be capitalized.
I will claim and fix
Can anyone confirm? I believe this is the fix
"getUserInput => assert(getUserInput('index').match(/import\\s+\\{\\s*capitalizeString\\s*\\}\\s+from\\s+(\"|')(\\.\\/)*string_functions\\1/g), 'valid <code>import</code> statement');"
so the issue is that the tests (not a specific test) fail because the capitalize function is being pulled from the window object, so when you change how it is imported the code fails to run.
I think the description of these challenges need to be improved to state we aren't importing from a file for the challenge but from an unorthodox method of using the window object.