Skip to content
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

[sementic-dom-diff] Typings added in 0.19.8 interfere with all Should assertions #2675

Open
rhelling opened this issue May 18, 2023 · 1 comment · May be fixed by #2697
Open

[sementic-dom-diff] Typings added in 0.19.8 interfere with all Should assertions #2675

rhelling opened this issue May 18, 2023 · 1 comment · May be fixed by #2697

Comments

@rhelling
Copy link

Expected behavior

When i have a test that doesn't use semantic-dom-diff I expect the should assertion not to be asynchronous

Actual Behavior

An equal assertion to be synchronous

Describe what happens instead.

When using eslint it picks up the typings from chai-dom-diff-plugin.d.ts and reports async calls should be awaited.

error Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the void operator.

Additional context

See eslint result in the console output of this stackblitz project:
https://stackblitz.com/edit/semantic-dom-diff-typeings?file=src%2FArithmetic.test.ts

Which packages and versions are you using.

@open-wc/testing: "3.1.8",
@typescript-eslint/eslint-plugin: "^5.51.0",
@typescript-eslint/parser: "^5.51.0",
eslint: "^8.40.0",
eslint-plugin-lit: "^1.8.3",

Also see: package.json

@xt0rted
Copy link

xt0rted commented Jul 17, 2023

Dependabot just opened a PR in my project updating @open-wc/testing from 3.1.8 to 3.2.0 which also updates @open-wc/semantic-dom-diff from 0.19.7 to 0.20.0 and now eslint is failing with the same error.

The code that's being flagged:

const el: CustomElement = await fixture(html`
  <custom-element>
    <input ...>
  </custom-element>
`);

const input = el.querySelector<HTMLInputElement>("input");

// Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.
// @typescript-eslint/no-floating-promises - https://typescript-eslint.io/rules/no-floating-promises
expect(input).to.equal(document.activeElement);

Ping @Westbrook - this issue is coming from #2419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants