Skip to content

Fix shadow test state pollution#26607

Merged
calebcordry merged 1 commit intoampproject:masterfrom
calebcordry:runtime-debug
Feb 5, 2020
Merged

Fix shadow test state pollution#26607
calebcordry merged 1 commit intoampproject:masterfrom
calebcordry:runtime-debug

Conversation

@calebcordry
Copy link
Copy Markdown
Member

I was debugging test failures in #26447 and found that if I ran test-runtime.js directly it would work, but if I ran test-shadow-embed.js with it, it would always fail :(

Turns out in some of our tests, we manually set the streaming supported flag through setShadowDomStreamingSupportedForTesting. This value gets cached here

amphtml/src/shadow-embed.js

Lines 328 to 331 in eccff2d

export function isShadowDomStreamingSupported(win) {
if (shadowDomStreamingSupported === undefined) {
shadowDomStreamingSupported = calcShadowDomStreamingSupported(win);
}

These tests would reset this flag in a beforeEach block, but this would not clean up this state for the last test in the section, causing hard to track test failures.

Moves the resetting of this state to an afterEach block instead, which seems to solve the problem.

@calebcordry calebcordry merged commit 20b8997 into ampproject:master Feb 5, 2020
@calebcordry calebcordry deleted the runtime-debug branch February 5, 2020 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants