Unit testing a game, is it even possible? 🕹️🟢 Let's try with #WebTestRunner, live now on https://www.twitch.tv/noyainrain 😊 #TypeScript #JavaScript #Phaser #OpenSource #IndieDev
noyainrain - Twitch

2D Model Renderer (Part 17) | It's Thursday again! 👋💜

Twitch

Turns out, not a #Chrome bug instead a #WebTestRunner / #Puppeteer bug. Apparently concurrent tests run multiple tabs in the same window by default. This means only one page is visible and pages in the background don't update consistently, meaning `requestAnimationFrame` just doesn't get called sometimes.

https://github.com/modernweb-dev/web/issues/2588

This is fixable by giving each test its own window, so every test is always visible.

Definitely not an obvious workaround though, so hopefully this is something which can be fixed by default.

Concurrent tests don't call `requestAnimationFrame` consistently with Puppeteer · Issue #2588 · modernweb-dev/web

Took a while to debug this one, but I was writing some tests which I discovered to be flaky for uncelar reasons. After a lot of digging, I was able to confirm a minimal test case where the requestA...

GitHub

Pretty convinced I've got a Chrome bug on my hands here at this point.

Took all night, but I was able to narrow down the test cases to two files <15 lines each failing on latest #WebTestRunner and #Puppeteer.

Last step is to strip #Jasmine from this and see if I can reproduce similar behavior with `setTimeout`, then file the bug.

I've tried to get a minimal reproduction but this _literally_ takes at least 6 tests across 2 different files to replicate. Disabling any _one_ test fixes all of them. No shared state between them which I can find. The two files *should* be completely isolated from each other anyways (using #WebTestRunner).

I'm completely baffled here.

@westbrook I *think* I got all the options. I don't see anything else in your example which looks related.

https://github.com/dgp1130/composite-weak-map/commit/49c09375ec9550e9a0328b0ef8250783f2407c40#diff-24d782e02f46a1eb18aed719d1c73354c23a5702d6e324a6163f6d90a6965cad

Even outside #WebTestRunner I can't get it to work. Just running the #Chrome binary directly with those flags doesn't work either. There must be some other condition for `window.gc` I'm not finding...

WIP · dgp1130/composite-weak-map@49c0937

Contribute to dgp1130/composite-weak-map development by creating an account on GitHub.

GitHub

@westbrook Ooh, that's very cool. I was not aware of that API.

I'm trying to copy what you did there and was able to spawn #WebTestRunner with `measureUserAgentSpecificMemory`, but for the life of me can't get `window.gc` to be defined. I'm setting the `--expose-gc` flag just like you seem to, but I can't get Chrome to start with it. Is there some other special incantation I need to do this?

https://github.com/adobe/spectrum-web-components/blob/e5a1a61bae448005abab9e6aa1a4be5c3efa3372/web-test-runner.utils.js#L37

spectrum-web-components/web-test-runner.utils.js at e5a1a61bae448005abab9e6aa1a4be5c3efa3372 · adobe/spectrum-web-components

Spectrum Web Components. Contribute to adobe/spectrum-web-components development by creating an account on GitHub.

GitHub
Web Test Runner: Modern Web

Guides, tools and libraries for modern web development.

Modern Web

Building on this area...

Testing is like a magic power, but lean into magic realism over magic fantasy for better results: https://dev.to/westbrook/testing-with-js-is-like-magic-but-is-it-science-23f8

Now to get to work on the next installation!

#webComponents #webTestRunner #testing

Testing with JS is like magic, but is it science?

If that title doesn't get you riled up, I know what will... Last time on "Testing Web...

DEV Community

#Angular announcement: We're moving Angular to #Jest and #WebTestRunner.

We've seen a lot of movement in the web testing ecosystem towards Jest and want to make it more available for #AngularCLI users.

We've also been particular impressed with Web Test Runner and are looking forward to bringing it into the Angular ecosystem as well.

Check out the #AngularBlog for all the details:

https://medium.com/angular-blog/moving-angular-cli-to-jest-and-web-test-runner-ef85ef69ceca

Moving Angular CLI to Jest and Web Test Runner - Angular Blog

On the Angular team, we believe testing is critical to build highly complex and scalable applications effectively. Testing takes many forms, and “unit tests” focus on testing the smallest units of a…

Angular Blog

So, if you're into #webComponents...

And, more importantly #testing them...

And, most importantly doing it with #webTestRunner...

Then you might be into the new post I wrote: https://dev.to/westbrook/testing-web-components-with-webtest-runner-51g6

Looking to make this part of series where I touch on a whole bunch of extended techniques and practices that I've found useful in this area, so share your thoughts in the comments or in response this toot.

Learn more about @​web/test-runner here: https://modern-web.dev/docs/test-runner/overview/

Testing Web Components with @web/test-runner

So, you write web components and you're interested in expanding the work you put into unit testing...

DEV Community