Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests stops at "mocha:test" #2355

Closed
niksy opened this issue Jul 31, 2018 · 19 comments
Closed

Tests stops at "mocha:test" #2355

niksy opened this issue Jul 31, 2018 · 19 comments

Comments

@niksy
Copy link
Contributor

niksy commented Jul 31, 2018

When running on Node 8, tests stop at mocha:test task.

> grunt test --stack

(node:4106) ExperimentalWarning: The http2 module is an experimental API.
Running "clean:dist" (clean) task
>> 5 paths cleaned.

Running "eslint:target" (eslint) task

Running "pug:compile" (pug) task
>> 3 files created.

Running "instrument:files" (instrument) task
Instrumented 53 files

Running "env:coverage" (env) task

Running "mochaTest:test" (mochaTest) task


  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  ․․․․․․․․․․․․․․․․․․․․

  323 passing (2s)


Running "generate:dest" (generate) task

Running "connect:server" (connect) task
Started connect web server on http://localhost:9090

Running "mocha:test" (mocha) task
Testing: http://localhost:9090/test/unit.html
@rejas
Copy link
Member

rejas commented Jul 31, 2018

I do have that issue sometimes too, but not on every machine. Currently on a win10, node 8.11.3, npm 6.2.0 it runs all tests without hanging. Will report on it once I encounter it again.

@niksy
Copy link
Contributor Author

niksy commented Aug 1, 2018

@rejas When I update grunt-mocha to latest version, I get proper output but a lot of errors. I suppose setting larger version of grunt-mocha isn’t desirable right now?

What about using different runner for browser tests? For example, Karma is standard for these things so maybe we could use it? Also, PhantomJS is deprectaed and I didn’t see any support for using another modern headless solution like Puppeteer with Gunt, but karma-chrome-launcher has support for that.

@rejas
Copy link
Member

rejas commented Aug 1, 2018

@niksy yeah, the test suite is not really upgrade friendly (tried to update mocha like you did with similar results). grunt-mocha isnt also very responsive to PRs.
So I'd also like to see a refresh in that area but without rewriting all tests etc pp. Using grunt and karma-chrome-launcher sounds good, but I havent any experience with it, do you? How much rework would that be?

@niksy
Copy link
Contributor Author

niksy commented Aug 1, 2018

@rejas I would definitely go the route of setting up tests with minimal architecture changes, so only browser tests in Karma for now and then we will see for anything else later.

I have experience with Karma (on daily basis I would say :D) and I can set up test environment with Puppeteer. I suppose it would be too much work to do that since Mocha is browser friendly, but it remains to be seen :)

I don’t know when this will be ready since I’m going on vacation for 2 weeks, but in the meantime if anything changes with current implementation, great! If not, I will try to create minimal PoC with Karma.

@rejas
Copy link
Member

rejas commented Aug 1, 2018

Have a nice vacation, those test issue probably wont go anywhere (it works somehow :-)

@rejas
Copy link
Member

rejas commented Aug 1, 2018

Will read a little about testing in the meantime, will need it for other projects (and work) too.

Maybe I pick up work on the update_chai branch again where I only try to replace the old expect.js lib with chai.js. Still two strange errors in it though, not sure where they come from (maybe mocha?) So, yeah that might be a starting point for you too?

Will need a node and brwoser based environment as far as I understand the grunt / code correctly.

And what do you think about jest by the way?

@niksy
Copy link
Contributor Author

niksy commented Aug 2, 2018

@rejas So… I actually had some time and I whipped up initial conversion to Karma runner :D

You can see it here: https://github.com/niksy/Modernizr/commit/1f404956

Every test passes in Chrome, so testing in other browsers is a process of setting up additional launchers and setting up Sauce Labs support.

This still needs coverage reporting and integration tests but we’re getting somewhere :D

As for Jest… I don’t have any experience with Node testing frameworks other that Mocha, and I think Jest still doesn’t have proper real browser support, and I think Modernizr needs that.

So, what do you think? And @patrickkettner, what do you think about switch to Karma runner for tests?

@patrickkettner
Copy link
Member

patrickkettner commented Aug 2, 2018 via email

@niksy
Copy link
Contributor Author

niksy commented Aug 2, 2018

@patrickkettner Ah, I see. So maybe we should still keep original implementation, but fix hanging tests?

I suppose browsers defined in Sauce configuration are browsers which are used for testing. Maybe we could try to run tests on those browsers and see how it behaves?

@escodel
Copy link
Contributor

escodel commented Oct 16, 2018

Not sure if this is related, but I saw this issue was still open and I'm now getting the following in my mocha:test task when running grunt browserResults

(node:10272) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
Testing: http://localhost:9999/test/index.html


  ......
Warning: PhantomJS timed out, possibly due to a missing Mocha run() call. Use --force to continue.

Tried updating grunt-mocha but got way more errors/warnings so reverted back to what's currently in use. Also tried installing grunt-mocha-phantomjs to no avail.

Node 8.12.0
npm 6.4.1

Any known way to resolve this? Thanks in advance!

@rejas
Copy link
Member

rejas commented Oct 16, 2018

@escodel I have the same versions and can run grunt browserResults as well as npm test without hang-ups. The DepreactionWarnings shouldnt be a problem (yet) but no time to check those.
I am running on Win10, you too?

@escodel
Copy link
Contributor

escodel commented Oct 16, 2018

@rejas Yep, Win10 for me too. I’m thinking another package might’ve updated the version/path for PhantomJS. Will check when I get time later today.

@rejas
Copy link
Member

rejas commented Oct 16, 2018

Weird, I have this issue only on my mac book....

@rejas
Copy link
Member

rejas commented Oct 16, 2018

(and yeah, upgrading grunt/mocha leads to another path full of errors, that bug is not for the faint of heart))

@escodel
Copy link
Contributor

escodel commented Oct 16, 2018

Alright so I figured out the issue... kind of. navigator.connection was returning undefined causing PhantomJS to get hung up. The other feature-detect for connection has a polyfill but I think this is an issue with the version of phantom not supporting navigator bug. Will try and update phantom again.

@rejas
Copy link
Member

rejas commented Oct 20, 2018

Any news on updating phantom @escodel ?

@escodel
Copy link
Contributor

escodel commented Oct 20, 2018

@rejas I think it was an installation error on my part. Conflicting versions. It worked once I un/re-installed.

@rejas
Copy link
Member

rejas commented Oct 22, 2018

@escodel darn, I was hoping to find someone who knows a fix to the tests dont run on node10 and some other setups.... :-(

rejas added a commit that referenced this issue May 15, 2019
@rejas
Copy link
Member

rejas commented May 15, 2019

Fixed via #2429

@rejas rejas closed this as completed May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants