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

Not compatible with jest 27 #963

Closed
lukeapage opened this issue May 28, 2021 · 9 comments
Closed

Not compatible with jest 27 #963

lukeapage opened this issue May 28, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@lukeapage
Copy link

  • @testing-library/dom version: 7.31.0
  • Testing Framework and version:
    Jest 27.0.1
  • DOM Environment:
    jsdom: 16.6

What you did:

After upgrading to jest v27 I get an error:

  ● Test suite failed to run

    TypeError: Cannot destructure property 'DOMElement' of '_prettyFormat.default.plugins' as it is undefined.

      at Object.<anonymous> (node_modules/@testing-library/dom/dist/pretty-dom.js:33:3)
      at Object.<anonymous> (node_modules/@testing-library/dom/dist/config.js:11:18)

Problem description:

I believe jest's pretty-format package changed from exporting on "default" to exporting directly. Even though dom testing library requires a older version, jest requires the newer version, so when dom testing library requires it, it gets the newer version...

Suggested solution:

I can only think to publish a new major version which will not be compatible with jest 26 but will work with jest 27. I believe you just need to remove .default.

benbrown pushed a commit to microsoft/BotFramework-Composer that referenced this issue Jun 11, 2021
this is required due to a dependency resolution conflict within @testing-library/dom. See testing-library/dom-testing-library#963
cwhitten added a commit to microsoft/BotFramework-Composer that referenced this issue Jun 18, 2021
* make jest tests silent

* fix path warning in tests

* don't hide build/ or node_modules/

* fix createUploadHandler test

* fix conversation handler test

* use github actions reporter for test results

* include test location in output

* move jest dep into test-utils and use correct reporter name

* ignore tests in dist

* fix up botProject open handle

* bump browserslist and update caniuse-lite

* use node env for node tests

supposedly this should help speed up tests that do not require jsdom

* perpare server for @swc-node/jest

* prepare client for @swc-node/jest

* switch to swc for transpiling ts in tests

* fix compiler errors

* removed unused var

* special case the fallback recognizer (#7634)

* chore: bump wait-on to v5.3.0 (#7648)

* fix: update left nav and top bar strings (#7609)

* start fixing header

* adjust header chrome and left nav order

* Update en-US.json

* fix typecheck errors

* fix unit tests

* Update en-US.json

* change Design to Create in e2e tests

* Update LuisDeploy.spec.ts

* update flaky check in visitPage

* add 'checked' flag to visitPage to minimize surface area

* fix punctuation

* fix e2e test!

* fix security issue

* Revert "fix security issue"

This reverts commit 3aa6e3e4e36a951bb37244e01dd411fa4eca10dd.

Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>

* fix: rephrase Enable Orchestrator dialog (#7639)

* "Add a skill" page changes

* Update EnableOrchestrator.tsx

* Update skill.test.tsx

* Update package.json

* Update yarn.lock

* Update en-US.json

* fix: Update provision & publishing copy (#7583) (#7642)

* Issue-7583: update copy for provision and publishing

* en-us json files

* Issue-7583: fix formatDialogTitle

* Issue-7583: refactor formatDialogTitle

* Issue-7583: reformat azure provision dialog block

* PR fixes

* Fixed spacing

Co-authored-by: GeoffCoxMSFT <gcox@microsoft.com>

* fix: Added cleanup logic to app on quit (#7645)

* Added cleanup logic to app on quit

* Added missing electron ipc event listener

Co-authored-by: TJ Durnford <tjdford@gmail.com>
Co-authored-by: Soroush <hatpick@gmail.com>

* feat: show tunneling information notification when starting bot with remote skills (#7611)

* add util to get device OS

* add port to local publish result

* add port to botEndpointsState

* show ngrok notification when starting a bot with remote skills

* only show the remote skills notification onces per session per bot

* update l10n file

* address feedback

* update locale file after merge

* fix failing test

Co-authored-by: Soroush <hatpick@gmail.com>

* feat: detect "old" bots and migrate them to new runtime (#6526)

* introduce a migration system for updating legacy projcts to the 2.0 runtime

* updated

* ensure root dialog gets updated appropriately

* adjust method for updating root dialog

* remove comments

* fire migration warning when loading bot

* use original project name for new project

* close modal on submit

* address feedback

* add confirm modal

* Rename azureFunctionsPublish publish targets to azurePublish (new shared id)

* Delete a.en-us.lu

* Delete a.en-us.qna

* Delete b.en-us.lu

* Delete b.en-us.qna

* Delete bot1.en-us.lu

* Delete bot1.en-us.qna

* do not require pva to migrate

* Add missing parameters

* clarify types

* Fix tests
reduce redundant code

* Fixes #6844: migrate appinsights key to new location

* fix migrate lint issue

* plumb through the yeomanOptions parameter, required to set the location of the settings folder when migrating

* feat: new validation pipeline - schema existence validation (#7001)

* add placeholder for schema validator

* add schema validator pipeline with mocked fn

* add schema visitor

* display diagnostics data in debug panel

* revert sdk.ts

* decrease schema diagnostic severity to 'Warning'

* optmize path join logic

* impl a unified walker covers SwitchCondition

* fix lint error: use BaseSchema

* feat: disable actions without schema

* wrap in useEffect

* optimization: avoid frequent recoil submission

* optimization: aggregate paths rather than updatedDialog to reduce time complexity

* chore: comments & var name

* lint

* add comments

* defense undefined skip-level 'actions'

* defense potential exceptions

* get sdk.schema content correctly

* fix lint

* fix folder name case problem

* Do not specify the luis endpoint key as a parameter to the runtime if no vlaue is present (#7240)

(leaving this paramter blank causes issues on windows)

* disable telemetry calls in the provision dialog while we investigate why telemetryclient is null (#7256)

Co-authored-by: Geoff Cox (Microsoft) <gcox@microsoft.com>

* prefer the botName field instead of the name field when managing connections (#7262)

* fix: Empty Webchat inspector text and Disabling items in PVA context (#7241)

* show floating notifications over eveything (#7269)

Co-authored-by: Soroush <sorgh@microsoft.com>

* Region for Microsoft Bot Channels Registration is now global (#7270)

Co-authored-by: Ben Brown <benbro@microsoft.com>
Co-authored-by: Soroush <hatpick@gmail.com>

* fix: adjust package manager feeds (#7243)

* Fix #7092: set default page size to 100 items

* Fixes #6854: merge community feeds into main feed, sort by downloads

* Fixes #7043: include any component tagged msbot-component

* improve error handling

* restore different checks for declarative only vs code driven components

* refactor to use includes instead of indexOf

Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com>

* fix: remodel About page (#7191)

* remodel About page

* add SHA to version

* fixes from suggestion

* get info from Electron and use it for Release field

Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>

Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
Co-authored-by: Ben Brown <benbro@microsoft.com>
Co-authored-by: Geoff Cox (Microsoft) <gcox@microsoft.com>
Co-authored-by: Srinaath Ravichandran <srinaath27@gmail.com>
Co-authored-by: Soroush <hatpick@gmail.com>
Co-authored-by: Soroush <sorgh@microsoft.com>
Co-authored-by: Vamsi Modem <12182973+VamsiModem@users.noreply.github.com>
Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com>

* fix mapping of schema files during migration

* fix lint

* fix default name of migrated project

* run schema merge as part of the migration

* do we need to migrate teh schema? or not?

* do not migrate schema

* - Adding field for runtime language
- Fixing field population for runtime type

* Passing runtime lang and type down to yeoman calls

* Fixing adaptive runtime name

* Hardcoding runtime version and fixing settings page generation on migrate

* Fixing check for 'inBotMigration' to be based on CreationStatusState > path substring

* Fix default naming

* revert preload.js

* Resolving PR comments and fixing errors from merge

* Change schema diagnostics severity to 'Error'

* Fetch @latest version from npm before migration

Co-authored-by: Dong Lei <donglei@microsoft.com>
Co-authored-by: leilzh <leilzh@microsoft.com>
Co-authored-by: zhixzhan <zhixzhan@microsoft.com>
Co-authored-by: zeye <zeye@microsoft.com>
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
Co-authored-by: Geoff Cox (Microsoft) <gcox@microsoft.com>
Co-authored-by: Srinaath Ravichandran <srinaath27@gmail.com>
Co-authored-by: Soroush <hatpick@gmail.com>
Co-authored-by: Soroush <sorgh@microsoft.com>
Co-authored-by: Vamsi Modem <12182973+VamsiModem@users.noreply.github.com>
Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com>
Co-authored-by: Patrick Volum <pavolum@outlook.com>
Co-authored-by: Chris Whitten <christopherwhitten@gmail.com>

* fix: data race writing on setting file (#7475)

* fix data race writing on setting file

* remove isSkill in skillConfiguration

* remove default allowedCallers value

Co-authored-by: TJ Durnford <tjdford@gmail.com>
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com>
Co-authored-by: Soroush <hatpick@gmail.com>

* remove appsettings file from default gitignore (#7679)

* fix: restore line beneath page header (#7676)

* Update Page.tsx

* Update BotProjectSettings.tsx

* chore: Rebase main with 1.4.1 release (#7678)

* exclude items from the package manager list that do not have names or versions -- such as locally implemented custom actions (#7683)

* Add components field to migrated settings. Guard against missing field during component merge (#7674)

Co-authored-by: Dong Lei <donglei@microsoft.com>
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>

* fix: (Un) Installing a package now stops the currently running bot beforehand (#7689)

* Feed string, not int, to Switch per schema (#7707)

Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>

* fix: generate manifest file when creating new publish target (#7666)

* generate manifest file when creating new profile

* test

Co-authored-by: Lu Han <32191031+luhan2017@users.noreply.github.com>
Co-authored-by: TJ Durnford <tjdford@gmail.com>

* fix: converting bot with custom actions (ui update) (#7672)

* Hides the PVA publish profile from the profle creation dropdown (#7725)

* fix: set func-related settings during build step (#7723)

* set func-related settings during build step

* slight refactor to reduce duplicated code

* add type

* add typings in runtime plugin definition

* set type of port to number

* fix types, remove _ on variables that are used

* feat: Add preparatory work before connecting remote skill (#7519)

* draft dialog

* ux css

* css

* jump to create profile & set microsoftAppId to publish target

* comments & lint

* refactor dialog wrapper

* fix publish types missing in provision dialog (#7697)

* test case

* refactor

* fix type define

* fix title and json parse

* fix app Id not sync when create new profile

* Adds AppID and Password sections

* test case fixed

* Adds AppID/Password

* Update copy

Co-authored-by: Soroush <hatpick@gmail.com>
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com>
Co-authored-by: VanyLaw <wenyluo@microsoft.com>
Co-authored-by: Lu Han <32191031+luhan2017@users.noreply.github.com>
Co-authored-by: Chris Whitten <christopherwhitten@gmail.com>

* fix: Revert changes to adaptive card templates to support PVA (#7808)

* fix: Revert changes to adaptive card templates to support PVA

* requested changes

* fetch publish types for each project

* fix: Throttle restart conversation (#7824)

* Throttle restart

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

* Remove await

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

* Updated throttle time

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

* Unit test update

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

* Enable only on connected

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

* removed if

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

Co-authored-by: Srinaath Ravichandran <srravich@microsoft.com>

* chore: automated localization updates (#7759)

* Localized resource files from OneLocBuild

* fix typos and stray apostrophes

* fix apostrophes

* typo fix

* Update en-US.json

* fix more apostrophes

* revert reversions

Co-authored-by: Composer Localization <botframework-composer-eng@service.microsoft.com>
Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com>
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>

* Deploy exception returns real error (#7837)

* fix: Fix missing data collection settings on server (#7814)

* fix: Fix missing data collection settings on server

* fix tests

* fix test again

* minor change

Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>

* fix: add inner scrollbar to selection area (#7782)

* scroll

* css

* test

Co-authored-by: Lu Han <32191031+luhan2017@users.noreply.github.com>
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>

* Migration: adjust target blob transcript field names (#7848)

* fix: Always use intermediate lg template for text and speak modalities (#7842)

* allow click outside blocking modals (#7727)

Co-authored-by: Soroush <sorgh@microsoft.com>
Co-authored-by: TJ Durnford <tjdford@gmail.com>

* fix: Remove depth and transparentBorders from FieldProps, remove ObjectArrayField, and refactor OpenObjectField (#6633)

* Remove depth and transparentBorder

* Update OneOfField dropdown styles

* Remove ObjectArrayField

* fix tests

* Refactor OpenObjectField

* updated test

* minor

* fix test

* minor

Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com>

* fix: Teaching bubble missing content (#7764)

* fix: Teaching bubble missing content

* Fix item ref

Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com>
Co-authored-by: Soroush <hatpick@gmail.com>

* fix: Reset allowed callers cache when switching between project settings (#7874)

* fix: Reset allowed callers cache when switching between project settings

* comment

Co-authored-by: Soroush <hatpick@gmail.com>

* fix: breadcrumb & show code button collision (#7720)

* fix breadcrumb & show code button collision

* use flex

* update styles

* observe button width, auto layout ... breadcrumb

* ignore typescript ResizeObserver declarations missing

* fix type in test

* useResizeObserver

* fix mock

Co-authored-by: Srinaath Ravichandran <srinaath27@gmail.com>
Co-authored-by: Soroush <sorgh@microsoft.com>
Co-authored-by: Soroush <hatpick@gmail.com>

* Update home feed for Build 2021 (#7912)

* fix (#7440)

Co-authored-by: Soroush <sorgh@microsoft.com>
Co-authored-by: TJ Durnford <tjdford@gmail.com>

* fix: Custom function declaration (#7775)

* Custom function declaration

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

* Typo in custom functions

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

Co-authored-by: Srinaath Ravichandran <srravich@microsoft.com>

* add new caller when caller still have empty list, just focus on the empty one (#7767)

Co-authored-by: Lu Han <32191031+luhan2017@users.noreply.github.com>

* Resolve dns-packet to 1.3.4 to fix CVE-2021-23386 (#7942)

Co-authored-by: Soroush <hatpick@fmail.com>

* fix: invalid profile case (#7784)

* invalid profile case

* comments

* remove unused component

* refactor publish profile wrapper dialog

* toekn page jump logic err

Co-authored-by: Lu Han <32191031+luhan2017@users.noreply.github.com>
Co-authored-by: Soroush <hatpick@gmail.com>

* fix: Need to wait for zip deployment to be done processing (#7858)

* Handled 202

* Added error case for processing

* Improvements

Co-authored-by: Soroush <hatpick@gmail.com>

* Update readme screenshot (#7918)

Co-authored-by: Soroush <sorgh@microsoft.com>

* upgrade json-ptr (#7988)

* update test-utils dependencies

* remove console overrides

* fix tests for jest 27

* use fake timers for jest

* fix more tests for jest 27

* fix merge conflict

* clean up

* replace HookResult with RenderResult

* fix orchestrator test

* fix test warning

* fix jest-haste-map warning

* fix testid error

* attempt to resolve NetworkError in tests that use jsdom

* rename test file

* globally mock http client

* fix unhandled rejection error

* clear mocks after each test

* fix type errors

* rename test file

* move integration tests into own workspace

this is required due to a dependency resolution conflict within @testing-library/dom. See testing-library/dom-testing-library#963

* remove unused dependency

* fix integration tests linting errors

* use correct directory for running e2e script

* re-enable parallel cypress tests

* pass --record option to cypress runner

* actually set up cypress to run in parallel

* add @testing-library/user-event to test-utils exports

* fix fixture path

* use fs-extra to ensure test bot directory

* update cypress comands

* remove pr trigger from pipeline

2 runs were happening. Trying to see if this fixes that.

* re-enable cleanup after all tests

* update lockfile

* fix mocks and disabled button checks

* add axios mock

* remove cypress examples

* add hasOrchestrator to useEffect dependencies

* add description to integration-tests package.json

* fix e2e script for windows

* remove console.log

Co-authored-by: taicchoumsft <61705609+taicchoumsft@users.noreply.github.com>
Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com>
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
Co-authored-by: natalgar <82851479+natalgar@users.noreply.github.com>
Co-authored-by: GeoffCoxMSFT <gcox@microsoft.com>
Co-authored-by: Tony Anziano <tonyanziano5@gmail.com>
Co-authored-by: TJ Durnford <tjdford@gmail.com>
Co-authored-by: Soroush <hatpick@gmail.com>
Co-authored-by: Ben Brown <benbro@microsoft.com>
Co-authored-by: Dong Lei <donglei@microsoft.com>
Co-authored-by: leilzh <leilzh@microsoft.com>
Co-authored-by: zhixzhan <zhixzhan@microsoft.com>
Co-authored-by: zeye <zeye@microsoft.com>
Co-authored-by: Srinaath Ravichandran <srinaath27@gmail.com>
Co-authored-by: Soroush <sorgh@microsoft.com>
Co-authored-by: Vamsi Modem <12182973+VamsiModem@users.noreply.github.com>
Co-authored-by: Patrick Volum <pavolum@outlook.com>
Co-authored-by: Chris Whitten <christopherwhitten@gmail.com>
Co-authored-by: Long Alan <alanlong9278@126.com>
Co-authored-by: Lu Han <32191031+luhan2017@users.noreply.github.com>
Co-authored-by: Long Alan <julong@microsoft.com>
Co-authored-by: VanyLaw <wenyluo@microsoft.com>
Co-authored-by: Srinaath Ravichandran <srravich@microsoft.com>
Co-authored-by: Composer Localization <botframework-composer-eng@service.microsoft.com>
Co-authored-by: Carlos Castro <carlosscastro@users.noreply.github.com>
Co-authored-by: Gary Pretty <gary@garypretty.co.uk>
Co-authored-by: Soroush <hatpick@fmail.com>
@timdeschryver
Copy link
Member

This should be resolved with the v8 release. Could you try it out please?

@lukeapage
Copy link
Author

I’ve been using it successfully on the v8 alpha releases so I assume v8 final is ok.

btw we still use legacy timers and things “seem to work” - I guess we are not exercising something that might break?

@andrevenancio
Copy link

It doesn't work for me. I'm running @testing-library/dom 8.1.0 and jest27.0.6`.

See multiple TypeError: Cannot destructure property 'AsymmetricMatcher' of '_prettyFormat.default.plugins' as it is undefined. warnings on my tests.

@lukeapage
Copy link
Author

Some testing library packages aren’t upgraded to 8 so you might have an old one in your package Json tree - try checking your yarn.lock /package-lock.json

@nickmccurdy
Copy link
Member

nickmccurdy commented Jul 11, 2021

You can also use npm ls @testing-library/dom or yarn why @testing-library/dom to see what version you have installed without opening your lockfile. If you're still having issues, please let us know your version. We're using Jest 27 now, so I have a feeling it's an issue with an older version.

@nickmccurdy nickmccurdy added the bug Something isn't working label Jul 11, 2021
@signal-intrusion
Copy link

signal-intrusion commented Aug 3, 2021

@nickmccurdy @lukeapage

Sorry. I have the same problem as @andrevenancio and I'm definitely using testing-library/dom 8.1 and jest 27:

➜ npm ls @testing-library/dom
my-package@2.0.0 /Users/blahblahblah
└─┬ @testing-library/react@12.0.0
  └── @testing-library/dom@8.1.0
  
➜ npm ls jest
my-package@2.0.0 /blahblahblah
└── jest@27.0.6

I blew away my package-lock and node_modules for a clean install and that did not fix the issue.

@signal-intrusion
Copy link

signal-intrusion commented Aug 3, 2021

I found a workaround: uninstall @types/jest, delete your package-lock.json, re-install.

The problem is that jest-diff@26.x uses an incompatible version of pretty-format. For some reason, @types/jest depends on jest-diff@26.x (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/jest/package.json#L4-L5). And for another reason, when you run jest with an npm script, jest uses jest-diff@26 from @types/jest which uses the old, incompatible pretty-format, even if you've installed pretty-format and jest-diff@27 as top level dependencies!

@jonioni
Copy link

jonioni commented Aug 8, 2021

This might be related to testing-library/eslint-plugin-jest-dom which specifies a dependency on "@testing-library/dom": "^7.28.1", forcing the download of @testing-library/dom@7.x.x and resulting in the above error. Uninstalling testing-library/eslint-plugin-jest-dom for now might help until it is updated.

@AndriiScribe
Copy link

this helped in my case yarn upgrade @testing-library/react -L -> upgrade to lates version 11.x -> 12.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants