Git Product home page Git Product logo

Comments (11)

shellscape avatar shellscape commented on June 8, 2024

Got a repo or gist that reproduces?

from mocha-chrome.

stoffeastrom avatar stoffeastrom commented on June 8, 2024

Not right now. I can look into that. It's a bit cumbersome since it's requirejs. Anyway I think the above doesn't make sense in that case since it's async. I'm calling mocha.delay() that adds a global run function that I later can call when all test files are required

from mocha-chrome.

shellscape avatar shellscape commented on June 8, 2024

Depends on the version of Require.js being used, but we add the following to our test runner template:

  <script>
  require([], function () {
    mocha.run();
  });
  </script>

That queues mocha.run until Require is done doing it's thing, all modules are defined, and all requires are ready. mocha.delay is another option.

from mocha-chrome.

stoffeastrom avatar stoffeastrom commented on June 8, 2024

I just tried a minimal sample with a gist

00:28 $ npx mocha-chrome https://rawgit.com/stoffeastrom/ecee627fdfd06bf9f29eabf7bb76873e/raw/c25c501676bbeb8a0c982340ab92807be0549264/index.html
function


  Test
    ✓ should work


  1 passing (19ms)

and it worked. I suspect it might have to do with the mocha.delay but needs more investigation. Anyway, a cool way to run a gist :)

from mocha-chrome.

stoffeastrom avatar stoffeastrom commented on June 8, 2024

So heres the repro

mocha-chrome https://rawgit.com/stoffeastrom/ecee627fdfd06bf9f29eabf7bb76873e/raw/84ca1c2c98a0fd870a7a9464be505916bcaba6f3/index.html

yields

Mocha-Chrome Failed: mocha.run() was called with no tests

If you get load timeout just run it again

from mocha-chrome.

stoffeastrom avatar stoffeastrom commented on June 8, 2024

I ran this locally and this seems to fix it for me

screen shot 2017-10-25 at 12 42 05

from mocha-chrome.

shellscape avatar shellscape commented on June 8, 2024

@stoffeastrom I'm having a really hard time following you. It's a best practice when reporting and discussing an issue to be clear and linear in your thoughts, as issue discussions are linear like a discussion forum. It's also a good practice not to post multiple successive posts, but rather edit your last post if there are no replies.

Your "repo" isn't a test repo; it's not even a suite of tests. It's an html file with no tests and just a mocha.delay call. So your issue seems to be claiming now that mocha saying there aren't any tests is incorrect, even though your test file contains no tests.

At this point I honestly have no idea what you're trying to report.

from mocha-chrome.

stoffeastrom avatar stoffeastrom commented on June 8, 2024

@shellscape Sorry for the confusion! As i linked before. This gist indeed has a test file. Just clone it and you will see. Problem occurs when using mocha.delay. When the browser shim is emitting started there isn't any tests loaded yet and mocha-chrome errors out. If I change it to instead emit on runner start it works.

from mocha-chrome.

shellscape avatar shellscape commented on June 8, 2024

Did you try what I posted in #13 (comment) ? And if so, did it work?

from mocha-chrome.

stoffeastrom avatar stoffeastrom commented on June 8, 2024

Yes I tried only using the mocha.run and that works.

from mocha-chrome.

shellscape avatar shellscape commented on June 8, 2024

OK so that's the route you'll want to go for testing with RequireJS.

Using the m.runner start event presents other concurrency issues that are problematic, which is why we didn't use that originally. That's based off of the same procedure that mocha-phantomjs-core uses, and that project dealt with the same concurrency issues in the past.

I'll also add a test using RequireJS to the test suite as a proof-of-concept for others on RequireJS moving forward.

from mocha-chrome.

Related Issues (19)

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.