Open lukegrecki opened 8 years ago
Same problem for me. All tests pass in the browser w/ Jasmine, but the learn
command fails in the same manner as above.
Same problem for me. Worked it out a bit with @bhollan though and found that I was doing two things that would trigger the errors. In the readRecipe()
function, I was using let
while declaring the variable in the for...in
statement, and I was using a template string in the body of the loop, like this:
for (let key in recipe) {
console.log(`this recipe calls for ${recipe[key]} of ${key}`);
}
...and it worked only when I changed that to:
for (var key in recipe) {
console.log("this recipe calls for " + recipe[key] + " of " + key);
}
It didn't work with let
and string concatenation, and it didn't work with var
and a template string, it only worked with var
and string concatenation.
IIRC, both let
and template literals were introduced in ECMA 6. Could the tests just be outdated, and not recognize the newer syntax? I only just started, so I wouldn't be surprised if I'm completely off-base, and I don't know how Jasmine works, but it seems like a decent guess. At the very least, maybe the instructions could be changed to specify using 'var' and string concatenation for hand-wavy reasons. That's a decent (if dirty) fix, I think.
Whoops, that last comment was intended for a different issue! edit: Deleted it.
There is a similar output for the other 3 specs.
npm test
doesn't work since there is nopackage.json
file. Not sure what else to try.