Juicy / juicy-html

A custom element that lets you load HTML partials into your Web page. Declarative way for client-side includes.
http://juicy.github.io/juicy-html/
MIT License
62 stars 12 forks source link

Use mocked AJAX to avoid network stack + polyserve delays in tests #46

Closed alshakero closed 6 years ago

alshakero commented 6 years ago

I gave it several shots with local Chrome and couldn't possibly come by the reason. Can we go for this?

tomalec commented 6 years ago

Could you also try Chrome on Linux in Sauce? As that was the problematic combination

alshakero commented 6 years ago

Passed too 😐

Not all of them.

tomalec commented 6 years ago

Ha! So at least we got a trace, how to reproduce it locally, try in Chrome on Linux :)

alshakero commented 6 years ago

Doing that now.

alshakero commented 6 years ago

yay. passing on Sauce Chrome Linux. but not travis image

alshakero commented 6 years ago

What to do now haha?

tomalec commented 6 years ago

Longer timeout fixed it for your local linux try? I suspect some nasty Chrome implementation bug like something on the edge of removing previous <link> and de-duping.

alshakero commented 6 years ago

Yes exactly. And I can't debug it! Because when I put debugger before console.warn it works without doing anything, and console.warn always points to Sinon's spy when I can see it. Quantum physics we are talking.

alshakero commented 6 years ago

@tomalec finally! Passing on Travis'es local Chrome and everywhere with 20ms delays.

Edit: I reorganized the files back now. They should pass 🙏

alshakero commented 6 years ago

Ready for review.

warpech commented 6 years ago

Why is juicy-html the only project that has a problem with that?

alshakero commented 6 years ago

Because AFAIK it's the only one that depends on real network requests for tests, and on them being timely. The issue can be anywhere in polyserve, the network stack, or even the OS. Because I have never seen a JS issue that is only reproducible in one OS version of Chrome.

alshakero commented 6 years ago

I'll conduct one more expirement to rule out polyserve.

alshakero commented 6 years ago

Nailed it. Using http-server for mocks solved the issue. https://github.com/Juicy/juicy-html/commits/use-http-serve-for-tests-mocks

However, I still lean to mocked ajax for speed and less-deps.