learn-co-curriculum / js-hashes-lab

Other
0 stars 2 forks source link

Specs not running properly with 'learn' #3

Open lukegrecki opened 8 years ago

lukegrecki commented 8 years ago

There is a similar output for the other 3 specs. npm test doesn't work since there is no package.json file. Not sure what else to try.


learn

Loading /Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/SpecRunner.html
Started

FFFF

addIngredient adds an ingredient to the recipe and returns the updated recipe

  file:///Users/luke/Development/code/js-hashes-lab-v-000/spec/recipes_spec.js:12:25
  attemptSync@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1510:16
  run@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1498:20
  execute@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1485:13
  queueRunnerFactory@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:518:42
  execute@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:306:28
  file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1708:44
  attemptAsync@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1520:16
  run@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1496:28
  execute@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1485:13
  queueRunnerFactory@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:518:42
  execute@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1694:21
  file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1708:44
  attemptAsync@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1520:16
  run@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1496:28
  execute@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1485:13
  queueRunnerFactory@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:518:42
  execute@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1694:21
  file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:541:83
  attemptAsync@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1520:16
  run@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1496:28
  execute@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:1485:13
  queueRunnerFactory@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:518:42
  execute@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/jasmine.js:548:25
  onload@file:///Users/luke/Development/code/js-hashes-lab-v-000/tmpTestSupport/boot.js:172:16

...
gj commented 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.

kjleitz commented 7 years ago

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.

kjleitz commented 7 years ago

Whoops, that last comment was intended for a different issue! edit: Deleted it.