-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add unit test for html reporter #3102
Conversation
I am sorry. |
Actually, I'm sorry I didn't reply to this sooner -- no need to worry that the issue's assigned (that just helps us track who's looking at it) or even that there's already work toward it, we're definitely open to alternative attempts and new contributions! While my preference is to ensure things are tested and coverage collected in all the "real" browsers Mocha supports, I still need to figure out whether that's even going to be doable with the recent upgrades relating to Mocha's test harness for browser usage. So, while I can't guarantee which we'd pick at this point, if you've already coded it up we may as well see how it compares. Would you mind keeping this open for further assessment (or, at least, make sure the fork/branch stays available)? Thanks! (And thanks for taking a shot at adding test for this, in any case!) |
Hi, @ScottFreeCode. |
a jsdom-based test is better than nothing imo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. I think, however, we just want to make this part of our existing browser tests.
- remove jsdom
- move the spec file into
test/browser-specific/
- append the spec path to
cfg.files
after this line http://github.com/mochajs/mocha/blob/chrome-headless-esm-tests/karma.conf.js#L145, so it runs as part of thedefault
case in theswitch
statement.
The browser tests should be running the HTML reporter, so in theory it should "just work" 😉 Please let me know if you run into problems.
I changed this.:smile: |
document.body.appendChild(mochaElem); | ||
} | ||
|
||
function sleep (fn, ms) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this in particular is going to be brittle / susceptible to race conditions. but this test suite is unlike anything else we have, so we don't have the tooling.
all of assertions involving markup in innerHTML
are also going to be brittle, but again, need better tooling.
I'm going to grab this PR and test it against saucelabs' browsers. if it is flaky, we'll have to change it. but if not, we'll just merge and deal w/ it later--unless, of course, you feel like pulling in Nightwatch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for reviewing.
Since I think I am not going to be able to achieve it,
Would you please grab this pull request ?
} | ||
|
||
function sleep (fn, ms) { | ||
return new Promise((resolve) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IE11 breaks with these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the arrow functions need to be replaced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the HTML attributes won't necessarily show in the same order, e.g.:
<li class="test pass fast"><h2>title<span class="duration">100ms</span>
<a class="replay" href="/context.html?grep=fullTitle">‣</a></h2>
<pre style="display: none;"><code>body</code></pre>
</li>
vs
<li class="test pass fast"><h2>title<span class="duration">100ms</span>
<a href="/context.html?grep=fullTitle" class="replay">‣</a></h2>
<pre style="display: none;"><code>body</code></pre>
</li>
Thank you for reviewing. |
I replaced the arrow functions and the comparing HTML attributes. |
Have you managed to test on IE11 yet? |
4547268
to
7613521
Compare
Any news here? |
@38elements So what? |
Description of the Change
This adds unit test for html reporter.
This is related to #3071 .