Repository navigation
Exercise both polyfill and native fetch in test suite - #258
Conversation
|
๐ข |
|
This is not yet ready. Locally I've upgraded mocha to get access to |
If someone just cloned this project, they might be tempted to `script/server` and try to run the test suite immediately. That won't work, because they have to run `make` first to obtain all npm and bower dependencies. However, they would get a blank HTML page which would be confusing because it's not immediately apparent what they did wrong. Now, an error message is rendered that suggests you should run `make`.
Before, in browsers that had native `fetch` implementation the polyfill code was never exercised by the test suite. This ensures that both implementations are exercised.
This is opposed to checking for native ArrayBuffer because the polyfill will only define `arrayBuffer()` methods if Blob is available.
Mysteriously, it doesn't implement it.
In general, I'm not a fan of patching production code to accommodate the test suite. Is there another way the tests can avoid this problem? |
There was a problem hiding this comment.
Shouldnt you define min-versions instead of fixed ones, e.g. Using caret operator ^?
There was a problem hiding this comment.
Usually, but in this case I don't want jshint dependency to move around at all, lest its behavior suddenly changes, causing failures in CI for unsuspecting contributors and their pull requests.
We could skip the test in the case we're testing with Firefox and we're exercising the polyfill code. Is that what you would want? It feels weird, because we're skipping the test because of a Firefox bug, when we can easily fix the bug. |
|
Skipping this test in Firefox sounds good to me. We're testing the native implementations only to ensure our polyfill behavior matches. We're covered in that case with Chrome. |
When exercising the polyfill in Firefox, the invalid JSON parsing error will cripple the test suite, causing cascading failures in Mocha HTML output as well as cause failures in unrelated tests. The code fix was proposed #157 but we decided not to pull it since it's a Firefox bug and Firefox now ships with native fetch anyway. Instead, we avoid running that test as part of our polyfill test suite.
Exercise both polyfill and native `fetch` in test suite
Before, in browsers that had native
fetchimplementation the polyfill code was never exercised by the test suite. This ensures that both implementations are exercised.Bonus features: better first-run experience when cloning the project and trying to run
script/server:/instead of having to type out/test/test.html;make.