-
Notifications
You must be signed in to change notification settings - Fork 13
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
Migrate to Web Test Runner and fix broken tests #137
Conversation
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.
Should the tests pass in this PR?
When I ran npm i
, npm run bootstrap
, and then npm run test
, I get a test error.
virtualize > uses the provided method to render items
Error: ResizeObserver loop limit exceeded
Otherwise looking great and only tiny license nits.
@AndrewJakubowicz thanks for running the tests locally-- I have gotten that error only once since switching so I thought I managed to work out how to await the reflows correctly. Looks like I have to dig in and get a more solid solution. |
@usergenic I don't think this is a timing issue with the tests. The |
I added a helper to specifically swallow errors captured by window.onerror which matched the ResizeObserver loop limit exceeded case in test/helpers.js called
|
…nce from Virtualizer comment.
import { ignoreWindowErrors, wait } from "../helpers.js"; | ||
import { expect } from "@esm-bundle/chai"; | ||
|
||
describe('ignoreWindowErrors helper', () => { |
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.
Nit: Some additional tests:
- A test where the thrown error doesn't match the regex and isn't caught.
- Maybe a test that checks that
afterEach
is cleaning up.
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.
I'm not quite sure how to use Mocha to test Mocha hooks just yet. But I added a nested case and an explicit error if teardown encounters an unexpected value in window.onerror...
…of nested ignoreXErrors advice.
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.
Sorry for these questions, this is looking great. These are just for context.
Will migrating the screenshot.js
tests come in a follow up PR? Currently npm run test:screenshot
doesn't work.
Thank you!
packages/lit-virtualizer/src/test/scenarios/testing-setup.test.ts
Outdated
Show resolved
Hide resolved
@AndrewJakubowicz yeah I am not deleting screenshot tests yet, but getting them fixed will be a much different undertaking. I tried messing with them but it got really fiddly really fast and there were enough changes in this one. |
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.
LGTM!
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.
LGTM!
Added a
helpers.js
to export a sharedwait()
function that we can use in tests to wait for renders to complete.