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

fix #14040: QUnit.reset() replaced by splitting up into individual tests #1457

Closed
wants to merge 5 commits into from

Conversation

lexi-sh
Copy link

@lexi-sh lexi-sh commented Dec 11, 2013

All unit tests that were changed are passing. JShint done without errors. Pull request fixes this ticket: http://bugs.jquery.com/ticket/14040

@markelog
Copy link
Member

/cc @Krinkle, @jzaefferer

@timmywil
Copy link
Member

Thank you!

Please sign our CLA.

@markelog
Copy link
Member

@timmywil he already signed it.

@timmywil
Copy link
Member

@markelog Ah, I searched for "Chris Jones" rather than "Christopher".

@Krinkle
Copy link
Member

Krinkle commented Dec 11, 2013

@cjqed 🌟 Thanks!

@lexi-sh
Copy link
Author

lexi-sh commented Dec 13, 2013

My pleasure. Is there anything else I need to do?

@dmethvin
Copy link
Member

Nope, this should be good. We're aiming for a beta3 next week and it should land before that. Thanks a lot for tackling this, it's one of those tasks that has no glory so it's often ignored. I'll add a star as well: 🌟 😺

@markelog
Copy link
Member

@cjqed there is also some calls of QUnit.reset in testrunner.js, they are also mentioned in the ticket description, would you like to handle them as well?

@lexi-sh
Copy link
Author

lexi-sh commented Dec 16, 2013

@markelog Sure, I saw it originally and wasn't exactly sure how to handle it but upon re-reading some of the code in there I see what needs to be done. I'll do that and commit to this branch.

@lexi-sh
Copy link
Author

lexi-sh commented Dec 19, 2013

@markelog Is there anything else I need to do? Thanks!

@dmethvin
Copy link
Member

@cjqed I'm getting an error when I build this and run unit tests, if you're available can you take a look? Probably something simple.

capture

@lexi-sh
Copy link
Author

lexi-sh commented Dec 19, 2013

@dmethvin Sorry! Didn't notice that one. Try now?

@markelog
Copy link
Member

@cjqed Do not add empty.js, use either innerHTML prop or create jQuery.config.fixture as jQuery object beforehand.

Otherwise it could generate some weird problems in the future, since our tests, unfortunately, depend on each other.

@markelog
Copy link
Member

@cjqed It looks to me that instead of removing QUnit.reset we now have our own private QUnit.reset that uses undocumented features and has a vague logic :-(.

@lexi-sh
Copy link
Author

lexi-sh commented Dec 19, 2013

@markelog I understand. The problem I'm running into is that sizzle is trying to access a relative path empty.js at ~/src/sizzle/test/index.html here:

<script id="script-src" src="data/empty.js"></script>

This is fine becuase ~/src/sizzle/test/data/empty.js exists. However, when running sizzle tests from the QUnit GUI, we get a file not found error (causing the odd issue with "unexpected token <") at ~/test/data/empty.js (Not surprising, looking for the relative path). I figured adding the empty file would be better than changing the src to an absolute path.

It looks to me that instead of removing QUnit.reset we now have our own private QUnit.reset that uses undocumented features and has a vague logic :-(.

Yeah, I wasn't too happy with that. Let me go back to the drawing board for the reset() function.

@markelog
Copy link
Member

trying to access a relative path empty.js at
Yeah, jQuery#html reprocess this script and tries to load it through our ajax module, by using innerHTML for example, you can avoid that.
Let me go back to the drawing board for the reset() function.

You could remove most of it logic, by making tests more atomic, like code for ajax and globals cleanup, but our integration tests for sizzle do not let you remove fixture chaos, unless you would make a PR for Sizzle repo as well.

An even then, we would still require requireFixture helper to stay on, but i guess it's another story, btw could you rebase?

@lexi-sh
Copy link
Author

lexi-sh commented Dec 19, 2013

I was thinking of looking at the logic for requireFixture and reset and at least trying to get around using the undocumented interface QUnit.config.fixture. I'm not really well-versed with QUnit itself though, by the way you make it sound it would be larger issue?

Since retooling the fixture chaos sounds necessary to fixing this and is a larger issue, I could git revert back to the commit without touching the testrunner.js so that at least QUnit.reset() isn't used in the actual tests and tests become a bit more atomic and rebase. I can then work on cleaning up sizzle testing for a separate pull request.

Is this a good idea, or would you want everything in the same pull request?

@markelog
Copy link
Member

I could git revert

You don't have to revert, just remove empty.js, replace

jQuery("#qunit-fixture").html(QUnit.config.fixture);

with

jQuery( "#qunit-fixture" )[ 0 ].innerHTML = QUnit.config.fixture;

Rebase and make sure everything works in 1.x-master, if there some merge issue it would more applicable to make a separate PR for 1.x-master too, then, i think, it would ready as is, for now.

I can then work on cleaning up sizzle testing for a separate pull request.

I would suggest you to start with removal of Globals methods, since they unneeded in master branch, then ajax atomicity, then Sizzle. Maybe even, some of those blocks are not meant to be removed, but we should try to bring down "hacks" to the minimum.

But in any case, it would be great if you could help us out.

@timmywil
Copy link
Member

just remove empty.js

This is automatically copied over when we run grunt bower. Can we do this without removing empty.js?

@markelog
Copy link
Member

@timmywil no it's not. By

remove empty.js
i meant the one on the test/data/empty.js path, not src/sizzle/test/data/empty.js

@markelog
Copy link
Member

btw you can remove empty.js from sizzle repo too, but i do not mean you have to, personally, i would prefer it to stay.

@timmywil
Copy link
Member

i meant the one on the test/data/empty.js path

gotcha, thanks for clarifying.

@lexi-sh
Copy link
Author

lexi-sh commented Dec 19, 2013

@markelog Hey, sorry for the question but I use hg at work and am still pretty wet behind the ears on git and rebasing. I made the changes and committed it to my 14040-remove-qunit-reset branch. Do I git checkout master, git rebase 14040-remove-qunit-reset and then push remote? I think that would squash the commit history on this branch into my local master branch, but this pull request is from the 14040 branch so it wouldn't do anything in this PR would it?

Again, sorry!

@markelog
Copy link
Member

Do the backup copy of your branch first.

Do I git checkout master

Yes, then pull from upstream, if haven't add an upstream, do it like that – git remote add upstream git@github.com:jquery/jquery.git,

then pull from it – git pull upstream master, then checkout 14040-remove-qunit-reset
and make a rebase – git rebase master, now your commits should be on top.

Then push. That should do it.

@lexi-sh
Copy link
Author

lexi-sh commented Dec 19, 2013

@markelog Did I do that correctly?

My last commit seems to fail the travis build, but it looks like it's failing on npm install, possibly having to do with 1bb6951?

@lexi-sh
Copy link
Author

lexi-sh commented Dec 21, 2013

@markelog Okay, did some more reading and realized I did not do that correctly. Instead of trying to fix the branch and have it be incredibly messy, would you mind if I created a new pull request from a new branch that's fresh from master?

@dmethvin
Copy link
Member

You can git push --force on this existing branch and it will wipe away your sins but keep the discussion, which is useful.

@lexi-sh
Copy link
Author

lexi-sh commented Dec 21, 2013

@dmethvin Thanks for the tip! That looks much better, and the travis build passed. Sorry for the issues!

@dmethvin dmethvin closed this in 537e9ce Dec 23, 2013
@dmethvin
Copy link
Member

@cjqed Thanks! 🌟 I landed this in master. I also tried cherry-picking it into the 1.x-master branch but it has enough variations there to make it a non-trivial exercise. Would you like to give that a try as well, and open a new PR for that? You're getting quite a workout for your first contribution!

@lexi-sh
Copy link
Author

lexi-sh commented Dec 24, 2013

@dmethvin Sure, I'll do the same for 1.x-master. Thanks! Happy to help 👍

markelog pushed a commit that referenced this pull request Jan 3, 2014
mescoda pushed a commit to mescoda/jquery that referenced this pull request Nov 4, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants