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

Test does not run via grunt/phantom, but OK in web browser #19

Closed
jrburke opened this issue Jan 31, 2013 · 13 comments
Closed

Test does not run via grunt/phantom, but OK in web browser #19

jrburke opened this issue Jan 31, 2013 · 13 comments

Comments

@jrburke
Copy link

jrburke commented Jan 31, 2013

OS 10.8.2, using phantomjs 1.8.1 and grunt v0.3.17:

  • git clone --recursive git@github.com:fabien-d/require-qunit-test.git
  • grunt qunit (success: "1 assertions passed")
  • Edit test/index.html and use the ../vendor/require-2.1.4.js instead of the 2.0.6 script.
  • grunt qunit (failure: 0 assertions passed)

This was originally filed as requirejs/requirejs#618. I am filing a ticket here because the require-2.1.4.js version of the test runs fine in QUnit in the browser, just opening test/index.html in a web browser.

While I am open to this being an issue with requirejs, my first thought is it may be due to how the qunit grunt task binds to the running qunit tests and how it detects with QUnit is "done".

One guess at the problem may be that requirejs 2.1.4 waits a bit longer to start the actual qunit test, after whatever signal the grunt qunit driver uses to detect "done".

So, any insight into what I might look at in the grunt qunit code, or pointers is appreciated.

@kevinparkerson
Copy link

Any progress with this issue? I've come across it for my build processes, though downgrading to 2.0.6 does work.

@Zammy
Copy link

Zammy commented Apr 16, 2013

Bah.... I was pulling my hair why the f### it was not working.

@vernak2539
Copy link

Is there any progress on this? It's been a while since anything. I have downgraded and it works, but seems like a larger workaround.

@jrburke
Copy link
Author

jrburke commented Jun 5, 2013

@frederickf in this comment may have found something about the test setup that may be important, you might try that to see if it fixes the issue for you:
requirejs/requirejs#618 (comment)

If it does fix the issue, please leave a comment back here and then maybe we can close this issue.

@shama
Copy link
Member

shama commented Jun 7, 2013

Is this related to this issue #35 where qunit needs to not start until everything is loaded?

@vernak2539
Copy link

@jrburke @shama just tried to fix my problem using #35 as an example, and it works correctly. Thanks for the help.

All I had to do was put <script>QUnit.config.autostart = false;</script> after my qunit script tag and before my require script tag. Then in my first test file, inside the require statement I put QUnit.start();

Works perfect, and now I don't have to have multiple versions of require lying around

samastur added a commit to samastur/mjp that referenced this issue Nov 17, 2013
Changed: Prevent automatic start of tests and start them manually
after requirejs was loaded and executed. This way tests are picked
up and run fine. Solves problem
gruntjs/grunt-contrib-qunit#19
@JeremyCarlsten
Copy link

I believe I am seeing something a little different. I've got a plugin that is converting decimals to the equivalent fraction. While trying to convert it to a grunt project It almost looks to me like the tests via grunt round differently then in the browser?
qunit
are a few of the errors I'm seeing via grunt; however, they are all green when the tests are run in the browser(s). Any suggestions?

@maboiteaspam
Copy link

sounds to be related to phantomjs. Did you report there ? With some reproducible examples.

@JeremyCarlsten
Copy link

I did not but I'll give that a whirl. Thanks.

Update(3/20/2014):
I went ahead and got a post out there on phantomjs(#12078)
Also, during some downtime at work I've discovered the issue occurs only when no GCF can be found, still pinpointing the exact issue. DemoRepo

Update:(3/21)
It appears to be an issue with how far down parseint converts numbers to either 1 or 0, grunt will make them 0 while the browser will make very small numbers 1.

@markusfalk
Copy link

Found this related to the issue. http://stackoverflow.com/questions/18392463/grunt-not-running-qunit-tests-on-phantom

Is there a solution yet?

@davidbau
Copy link

davidbau commented Apr 7, 2015

I've run into this issue for every requirejs-based grunt-contrib-qunit test I have, in several different projects. Doesn't affect tests that don't use require.js.

Suspect it is realted this change: db075a2

@jzaefferer
Copy link
Member

@davidbau that change is a week old, this issue and most of the comments are much older.

For an example of using QUnit, grunt-contrib-qunit and AMD via requirejs, check out these two files.

@Arkni
Copy link
Member

Arkni commented Feb 19, 2016

Going to close this out, as @jzaefferer already pointed (#19 (comment)) to an example of using QUnit, grunt-contrib-qunit and requirejs, which we can consider as a solution.

for a similar solution, see http://stackoverflow.com/a/34928952/3904791

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