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

ci: Explicitly add DOM types #949

Merged
merged 1 commit into from
Dec 1, 2021
Merged

ci: Explicitly add DOM types #949

merged 1 commit into from
Dec 1, 2021

Conversation

akash1810
Copy link
Member

@akash1810 akash1810 commented Dec 1, 2021

What does this change?

CI for the integration-test project is currently failing with:

Error: node_modules/@types/jsdom/base.d.ts(24,40): error TS2304: Cannot find name 'DocumentFragment'.
Error: node_modules/@types/jsdom/base.d.ts(41,28): error TS2304: Cannot find name 'Node'.
Error: node_modules/@types/jsdom/base.d.ts(172,19): error TS2304: Cannot find name 'HTMLScriptElement'.
Error: node_modules/@types/jsdom/base.d.ts(172,39): error TS2304: Cannot find name 'HTMLLinkElement'.
Error: node_modules/@types/jsdom/base.d.ts(172,57): error TS2304: Cannot find name 'HTMLIFrameElement'.
Error: node_modules/@types/jsdom/base.d.ts(172,77): error TS2304: Cannot find name 'HTMLImageElement'.
Error: node_modules/@types/jsdom/base.d.ts(181,38): error TS2304: Cannot find name 'Window'.
Error: node_modules/@types/jsdom/base.d.ts(185,24): error TS2304: Cannot find name 'Window'.

This suggests TypeScript cannot find types definitions for JsDOM. JsDom is a transitive dependency via Jest.

In this change we explicitly add the DOM types to tsconfig to solve this.

I don't fully understand why this has suddenly started happening. I suspect our lack of a lockfile on the integration-test project might have something to do with it.

I also don't fully understand why we didn't see CI issues in #931 which bumped the version of TypeScript...

See: https://www.typescriptlang.org/tsconfig#high-level-libraries

How to test

See CI.

Or more specifically, first witness the failing case:

  • Checkout main
  • Run ./script/ci
  • Witness failure similar to above

Then witness the passing case:

  • Checkout this branch
  • Run ./script/ci
  • Witness it succeeding.

How can we measure success?

CI should pass.

Have we considered potential risks?

Other than a lack of understanding the root cause...

Checklist

  • I have listed any breaking changes, along with a migration path 1
  • I have updated the documentation as required for the described changes 2

Footnotes

  1. Consider whether this is something that will mean changes to projects that have already been migrated, or to the CDK CLI tool. If changes are required, consider adding a checklist here and/or linking to related PRs.

  2. If you are adding a new construct or pattern, has new documentation been added? If you are amending defaults or changing behaviour, are the existing docs still valid?

CI for the `integration-test` project is currently failing with:

```console
Error: node_modules/@types/jsdom/base.d.ts(24,40): error TS2304: Cannot find name 'DocumentFragment'.
Error: node_modules/@types/jsdom/base.d.ts(41,28): error TS2304: Cannot find name 'Node'.
Error: node_modules/@types/jsdom/base.d.ts(172,19): error TS2304: Cannot find name 'HTMLScriptElement'.
Error: node_modules/@types/jsdom/base.d.ts(172,39): error TS2304: Cannot find name 'HTMLLinkElement'.
Error: node_modules/@types/jsdom/base.d.ts(172,57): error TS2304: Cannot find name 'HTMLIFrameElement'.
Error: node_modules/@types/jsdom/base.d.ts(172,77): error TS2304: Cannot find name 'HTMLImageElement'.
Error: node_modules/@types/jsdom/base.d.ts(181,38): error TS2304: Cannot find name 'Window'.
Error: node_modules/@types/jsdom/base.d.ts(185,24): error TS2304: Cannot find name 'Window'.
```

This suggests TypeScript cannot find types definitions for JsDOM. JsDom is a transitive dependency via Jest.

In this change we explicitly add the DOM types to tsconfig to solve this.

I don't fully understand why this has suddenly started happening.
I suspect our lack of a lockfile on the `integration-test` project might have something to do with it.

I also don't fully understand why we didn't see CI issues in #931 which bumped the version of TypeScript...

See: https://www.typescriptlang.org/tsconfig#high-level-libraries
Copy link
Contributor

@jacobwinch jacobwinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for figuring this out 🕵️👍

@akash1810
Copy link
Member Author

Reading jestjs/jest#12098, it looks like others are experiencing similar issues and have made similar fixes. Alternative suggestions on that issue is to downgrade to Jest v26.

We don't need JsDOM and it looks like Jest v28 would be better suited for us.

Will merge this to unblock main.

@akash1810 akash1810 merged commit d001f35 into main Dec 1, 2021
@akash1810 akash1810 deleted the aa-fix-ci branch December 1, 2021 10:28
akash1810 added a commit that referenced this pull request Dec 1, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2021

🎉 This PR is included in version 31.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants