Git Product home page Git Product logo

Comments (10)

sgharms avatar sgharms commented on June 27, 2024

As of commit: 638635a

If I run npm test I get, in my browser:

image

Am I missing something?

from js-looping-and-iteration-looping-code-along.

HyeokJungKim avatar HyeokJungKim commented on June 27, 2024

Screen Shot 2019-04-23 at 5 56 21 PM

Screen Shot 2019-04-23 at 5 56 49 PM

Here are some screenshots of the test not passing.
The code that they wrote was the one they copied and pasted from the Solution Branch.

from js-looping-and-iteration-looping-code-along.

drakeltheryuujin avatar drakeltheryuujin commented on June 27, 2024

@sgharms this is one of a handful of lessons that pass with the learn-co browser test system but fail when using regular mocha testing. Investigating why this happens.

from js-looping-and-iteration-looping-code-along.

RylanBauermeister avatar RylanBauermeister commented on June 27, 2024

So this happens because when you stub Math.random in a mocha file it copies your file-specific version of Math.random that got spun up as a requirement. It seems this issue also plagues new Date, if we use that in any other tests.

Overcoming it is apparently possible, but incredibly crufty. Here's a git repo walking through the process using mockery: https://github.com/newz2000/dice-tdd

My personal recommendation is to change the lab to utilize non-randoms. It would probably be less work than making this one work, and the amount of additional code interwoven into the normal lines would likely be very confusing for student.

Here's a screenshot of my specific failure pre-attempting to fix it:
Screen Shot 2019-04-25 at 12 31 07 PM
As you can see, the function is returning different values for numbers of tails flipped pretty consistently, but the test itself isn't stubbing the correct Math.random instance, and therefore is failing to recognize that it is called, or force specific return values.

from js-looping-and-iteration-looping-code-along.

sgharms avatar sgharms commented on June 27, 2024

Good research @RylanBauermeister . It's so strange that it works on some machines but not others, I wonder if the internals of rand() have changed between OS versions or some such. In any case, the reversion of the merge commit that brought in the random seems like a good strategy.

from js-looping-and-iteration-looping-code-along.

geluso avatar geluso commented on June 27, 2024

from js-looping-and-iteration-looping-code-along.

sgharms avatar sgharms commented on June 27, 2024

@geluso I believe the learn-browser dependency is the culprit. It's designed to de-scary mocha+chai ecosystem and is set up to look at a virtual DOM as a measure of success (ideal for dom-based challenges). we're testing to see if jettisoning that dep removes the breakage.

from js-looping-and-iteration-looping-code-along.

rrcobb avatar rrcobb commented on June 27, 2024

Another example for this issue learn-co-students/js-looping-and-iteration-looping-code-along-nyc-web-career-031119#12

from js-looping-and-iteration-looping-code-along.

maxwellbenton avatar maxwellbenton commented on June 27, 2024

Hey @geluso,

I've pushed up the rewritten content for this lab, removing the reliance on Math.random() and changing the tests and narrative a bit so this should no longer be an issue. Thanks for reporting!

from js-looping-and-iteration-looping-code-along.

geluso avatar geluso commented on June 27, 2024

Copy that! Saw the PR.

from js-looping-and-iteration-looping-code-along.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.