Skip to content

Conversation

@tbouffard
Copy link
Member

@tbouffard tbouffard commented Oct 25, 2022

Add jest-environment-jsdom dependency: as of Jest 28 "jest-environment-jsdom" is no longer shipped by default, make sure to install it separately.

Locally fix jest-playwright-preset@2.0.0 types with patch-package. This is a temporary solution until a new release including the fix is available.

Update the typescript-support test configuration to prevent the types used to develop bpmn-visualization from being part of the type resolution in the test project:

  • We don't want to test them (we only want to ensure types resolution is OK when bpmn-visualization is included in a project/application.
  • The previous configuration generates errors because some types needed at development time require a newer TypeScript version than the one supported by bpmn-visualization. For instance, jest@28 types requires TS 4.3 and typescript-support runs with TS 4.0
  • To do this, override the typeRoots configuration which included by default all development types (available in ../../node_modules)

closes #2004

Tests done

@tbouffard tbouffard added help wanted Extra attention is needed chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...) labels Oct 25, 2022
@github-actions
Copy link

github-actions bot commented Oct 25, 2022

♻️ PR Preview 3ccd089 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@github-actions
Copy link

github-actions bot commented Oct 25, 2022

♻️ PR Preview 3ccd089 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@tbouffard
Copy link
Member Author

❌ performance tests compilation is currently failing

Same errors if we run tsc on e2e tests 👇🏿

$ tsc -p test/e2e/
node_modules/@jest/test-result/build/index.d.ts:11:23 - error TS2307:
Cannot find module 'jest-haste-map' or its corresponding type declarations.

11 import type {FS} from 'jest-haste-map';
                         ~~~~~~~~~~~~~~~~

node_modules/@jest/test-result/build/index.d.ts:12:30 - error TS2307:
Cannot find module 'jest-haste-map' or its corresponding type declarations.

12 import type {ModuleMap} from 'jest-haste-map';
                                ~~~~~~~~~~~~~~~~

node_modules/jest-playwright-preset/types/global.d.ts:233:5 - error TS2709:
Cannot use namespace 'JestConfig' as a type.

233   | JestConfig
        ~~~~~~~~~~


Found 3 errors in 2 files.

Errors  Files
     2  node_modules/@jest/test-result/build/index.d.ts:11
     1  node_modules/jest-playwright-preset/types/global.d.ts:23

@tbouffard
Copy link
Member Author

ℹ️ I have just tested with jest@29 and the same problems occur (perf test compilation errors + foreignObject CSS selector).

Add `jest-environment-jsdom` dependency: as of Jest 28 "jest-environment-jsdom" is no longer shipped by default, make
sure to install it separately.
@tbouffard
Copy link
Member Author

tbouffard commented Nov 6, 2022

Current issue with Performance tests compilation

This also occurs if we run tsc with bundles and e2e tests as the issue is in jest-playwright types

node_modules/jest-playwright-preset/types/global.d.ts:233:5 - error TS2709: Cannot use namespace 'JestConfig' as a type.

233   | JestConfig

Root cause is playwright-community/jest-playwright#808
Possible workaround: use skipLibCheck=true in the tsconfig.json file used to compile the performance tests, but this will prevent to detect other issues in other dependencies.

@tbouffard tbouffard marked this pull request as ready for review November 15, 2022 06:08
@tbouffard tbouffard requested a review from csouchet November 15, 2022 06:09
@tbouffard tbouffard removed the help wanted Extra attention is needed label Nov 15, 2022
return `${this.labelSvgGroup(bpmnElementId)} > g > foreignObject > div > div > div`;
// * is for 'foreignObject'
// Using 'foreignObject' do not work anymore with jest@28 (jsdom bump for 16.6 to 19)
return `${this.labelSvgGroup(bpmnElementId)} > g > * > div > div > div`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch 👍🏻

Copy link
Contributor

@csouchet csouchet left a comment

Choose a reason for hiding this comment

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

Very good job. Thank you for this updating and the investigation 🎉

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@tbouffard tbouffard merged commit 0a82ed9 into master Nov 15, 2022
@tbouffard tbouffard deleted the test/bump_jest_v28 branch November 15, 2022 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[INFRA] Bump jest to v28

3 participants