-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: implementing custom fixture #9
Conversation
8300d80
to
0cfd335
Compare
b04dc8d
to
91c3a7e
Compare
"exports": { | ||
".": "./src/browser/index.js", | ||
"./wtr-config.js": "./src/server/index.js" | ||
}, |
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.
Had to split the exports since having them all in one file was causing the browser to blow up on Node.js things.
91c3a7e
to
311b0ec
Compare
package-lock.json
Outdated
@@ -715,6 +716,90 @@ | |||
} | |||
} | |||
}, | |||
"node_modules/@puppeteer/browsers/node_modules/ansi-styles": { |
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.
Is it weird that all this puppeteer
stuff is being added? 🤔
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.
It's a dependency of @web/test-runner-chrome
which is a dependency of @web/test-runner
... so not sure why it was ever not here?
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.
Huh yeah, that's super weird. We'll see what the update
job does 😓
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.
This was the result of me doing a fresh npm install
with no lock file, so hopefully it does nothing!
This comment was marked as resolved.
This comment was marked as resolved.
|
||
afterEach(() => restore()); | ||
|
||
describe('reset', () => { |
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.
These tests make me super excited to get to use this new fixture
!
test/browser/fixture.test.js
Outdated
await waitUntil(() => resolves.has('elem1')); | ||
const timeout = setTimeout(() => resolves.get('elem1')(), 50); | ||
const finished = await finishedPromise; | ||
clearTimeout(timeout); |
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.
Why do we need to clear the timeout?
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.
It's not necessary when everything is working correctly, but when things start to go wrong -- like if finishedPromise
resolves before the code in the timeout executes -- then the test can fail (as it should) but then the code in the timeout executes during the NEXT test.
But explaining this out gave me an idea to clean them up in afterEach
which should also make it clear why it's needed, so I'll make that change now!
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.
Awesome, yeah I like that much better!
Co-authored-by: Stacey Van Herk <[email protected]>
42586c6
to
ee8bde1
Compare
🎉 This PR is included in version 0.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Implementation of a custom
fixture()
method that extends theopen-wc
version but recursively waits for nested Lit elements to resolve theirupdateComplete
s.This doesn't currently include special handling for components that would like
fixture
to wait even longer (e.g. after an API call is complete), but that can be a future improvement.