-
Notifications
You must be signed in to change notification settings - Fork 108
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
Retry - Add stack trace to code recursively scheduling timers #325 #375
Conversation
Codecov Report
@@ Coverage Diff @@
## master #375 +/- ##
==========================================
+ Coverage 93.46% 93.84% +0.37%
==========================================
Files 1 1
Lines 551 585 +34
==========================================
+ Hits 515 549 +34
Misses 36 36
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
So this fails in IE 11, Safari 9, Firefox. This ties in with sinonjs/sinon#2359 which is about which browsers we officially support and that our docs is out-of-sync. We have dropped IE 11 and Safari 9 in favor of evergreen browsers, so we could ignore them here as well, but it fails in Firefox, which we do support, and we need to handle that somehow. @itayperry You could get our shared sauce labs credentials if you want to run the test suite locally, but it's probably just as fast to just fire up webdriver and modify the P.S. I will add a PR to remove the unsupported browsers: diff --git a/.min-wd b/.min-wd
index ddeba38..22abced 100644
--- a/.min-wd
+++ b/.min-wd
@@ -1,13 +1,5 @@
{
"browsers": [{
"name": "firefox"
- }, {
- "name": "internet explorer",
- "version": "11"
- }, {
- "name": "safari",
- "platform": "OS X 10.11",
- "version": "9.0"
}]
} |
per discussion in sinonjs#375 and sinonjs/sinon#2359
IE11 and Safari has been dropped. Any chance of seeing if you can get this running in Firefox as well? |
Yeah sure @fatso83, I don't know how to do it, but I would like to try! :) |
No worries - you don't have to fly alone, you know. Call out if you need a hand :) I have not done it personally, but |
Thank you @fatso83 for helping out and explaining everything!
Do you mean this script: I'm just guessing because this script shows It sounds great that I can edit the |
I was simply thinking that if you needed to test certain things in Firefox that failed in the Sauce Labs run you could just copy-paste the entire fake-timers.js script and just manually execute whatever failed in the test runs. This was just in case you had a hard time firing up Selenium locally and debug it, of course. The |
I didn't understand the script way at first, so I decided to try the other way with the local wd. And thank you for the email!! 🌼 and for all the help. |
As the docs say, you can either build it or use Skypack. Since the latter assumes it's already on NPM, you need to build it for the browser:
If you want to run all tests in the browser (without going through mochify):
|
Hi @fatso83, thanks for explaining - I tried both:
I'm gonna try to manually execute the code, do you know how do I access Another different thing I tried to do is to add |
Update: Eventually I used I'll soon edit this comment to add pictures. I'll continue working on it this evening :) BTW, something is wrong with GitHub right now.. I tried commenting the code itself but I keep getting a lot of 500 and 502 error messages, that's why I just put a link, I'm sorry for the mess :) |
test/fake-timers-test.js
Outdated
assert.equals( | ||
new RegExp( | ||
"Error: " + | ||
expectedMessage + | ||
"\\s+Microtask - recursiveQueueMicroTask\\s+at recursiveQueueMicroTask\\s" | ||
).test(err.stack), | ||
true | ||
); |
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.
That's the code that fails, I'm working on it.
Hi @fatso83 (and @benjamingr ) :) Tons of RegExp lol my head is spiraling! Edit: this needs a rebase, I'll do it soon. |
Use stack information for jobs and timers to provide more context when an infinite loop error is thrown. Fixes sinonjs#230 Add flag for approaching infinite loop Use a flag when approaching infinite loop detection which will enable an error object to be attached to the job, which can then be used for generating the stack output. Update for PR feedback - Safely update stack property using `defineProperty`, wrapped in try/catch - Tests for more clock functions to confirm stack trace provided - Stack trace slice automatically calculated based on clock function position Remove unnecessary durations and use globals - Use global setInterval and setImmediate to match setTimeout use - Remove unnecessary duration parameter from setImmediate and setImmediate add use of prettier Firefox and Chrome tests pass after RegExp fix Chrome shows stack messages differently, and uses the words: 'at' and 'Object', Firefox does not - that has created two problems: first, the stack trace messages that are shown to the user are a bit different (Firefox always has at least one more line at the start of the stack list - usually internal functions that are not supposed to appear). Second, the RegExp tried to match parts of the strings that only exist in Chrome, failing the Firefox tests) prettier used
b42b461
to
ffe4078
Compare
@itayperry I see why it fails! It's because we are kind of a unix shop, and I see the So ... either accept that you need to do a manual |
P.S. I have not checked out your code yet, but just a general thing: instead of trying to create One Regex To Rule Them All ™️ , you can try to split it up into different "branches" and test something depending on what matches some substring. Just to get the complexity down. |
ohhh now I get it! thank you :) I've used the WSL2 once, I'll try and use it again after I finish this PR.
I didn't think about it actually... RegExp can be quite intimidating sometimes for me. |
Update: now all the tests pass, which is wonderful :) [ eslint yelled at me lol - it didn't work at all and I think it was updated or something so I tried I fixed the errors but there are still approximately 100 warnings. EDIT: I can now see that code coverage is failing, I can sort of understand why (after googling about it), do you have any idea what I can do about it? Should I maybe add more tests? And one more question :) Does the coverage run only these tests - [ EDIT: I debugged some of the tests, the lines that the coverage warns about are actually being used sometimes and they're not always skipped. This is weird. |
Perhaps I should use something like this: |
Does this mean it actually runs in Firefox? |
@fatso83 Yes, it runs in Firefox, and from what I remember also in Chrome :) |
To me this sound like it's ready to merge :) |
Hi, @SimenB . Welcome back 😺 Not totally sure if there is something else breaking worth thinking about ... not quite sure why #385 would be breaking though. We have targetted Evergreen browsers for some time, so if ES2015+ features have snuck in, that's to be expected. My memory is old and faded, though 🤷 |
Ah, even better with no major 😀 |
@SimenB I released it as v8.0.0 now, since I was a bit unsure about how the removal of TS bindings would affect current installs. Someone might see some things break, so better safe than sorry. |
Thanks! |
Bare hyggelig 🇳🇴 |
Funka nesten 😀 There's a bug here, I'm seeing |
amagad, should we mark v8 as deprecated and move the latest tag to v7.x? |
Yeah, probably |
Ah, you do have rights already.
|
Re-adding the reverted merge - Add stack trace to code recursively scheduling timers #325
I've cherry-picked commits made by @alistairjcbrown to re-file the original PR that was merged and then reverted due to some compatibility issues.