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
Add fakeTimersLolex
to implement JestEnvironment interface
#44033
Add fakeTimersLolex
to implement JestEnvironment interface
#44033
Conversation
Since [jest 25.1.x](https://github.com/facebook/jest/releases/tag/v25.1.0), pull request [jest#8925](jestjs/jest#8925) added [fakeTimersLolex](jestjs/jest@0935f7c#diff-e8e69a5b9fa4b43b2e24abe1933d2855R44) property to `JestEnvironment` interface.
Since [jest 25.1.x](https://github.com/facebook/jest/releases/tag/v25.1.0), pull request [jest#8925](jestjs/jest#8925) added [fakeTimersLolex](jestjs/jest@0935f7c#diff-e8e69a5b9fa4b43b2e24abe1933d2855R44) property to `JestEnvironment` interface.
* fix(jest-environment-puppeteer): Class & Exports This makes the typings actually compatible to create your own test environment and not just as part of the bigger jest-puppeteer package. How to do this is pretty much what the test covers. One of the reasons to do this is to write a handler where Puppeteer takes screenshots after each failed test, as discussed [here](argos-ci/jest-puppeteer#131) * Change to `export =` syntax Co-Authored-By: Pranav Senthilnathan <pranav.senthilnathan@live.com> * Fix the last stuff requested
@typescript-bot I've reviewed the build errors, but I don't know how to resolve them. Azure Pipelines build result:
Travis CI build result:
|
@douglascayers Thank you for submitting this PR! 🔔 @JoshuaKGoldberg @ifiokjr @favna - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
@douglascayers The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
The compile errors are in a separate package, If you open https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/jest/index.d.ts locally, you should see two compile errors: I've come across this stackoverflow question but no answers. What is the recommended next action considering the issue is due to a package I'm not trying to update?? |
@douglascayers The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
@douglascayers The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
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. As for the failing CI, I think that including the dependencies in the package.json list of dependencies will resolve the issue but I'm not 100% sure on that. You can definitely try and run tests locally (npm run test
)
Unfortunately, updating the |
After my first attempt didn't work, I recalled that jest-diff and pretty-format are sub-packages of the jest monorepo. So I then tried again by adding the This led to an interesting different error after running
Thinking that
Realizing that those packages are in fact not part of DefinitelyTyped, then they must be external. And the next part of the error message had guidance on external dependencies:
Taking a peek at dependenciesWhitelist.txt, I saw that some other I then verified that In conclusion, I've submitted microsoft/types-publisher#769 to add |
Is this a bug in $ npm install @jest/environment
$ > index.ts
$ tsc --types @jest/environment index.ts
node_modules/@jest/environment/build/index.d.ts:8:23 - error TS2688: Cannot find type definition file for 'jest'.
8 /// <reference types="jest" />
~~~~
I don't know why |
(You get the |
I opened jestjs/jest#9875 to remove the |
Thanks @jablko for the help! |
🙌 Good news! @jablko's pull request jestjs/jest#9875 got merged into I imagine once they cut a new release (25.4.1+) then we can retry testing this pull request (I think..) |
@DouglasAntunes Tip: once that's released, other than waiting for staff to retrigger the CI processes, since PRs on this repo are squash and merged anyway you can just trigger it yourself at that time with an empty commit, in CLI: |
@douglascayers I haven't seen anything from you in a while and this PR currently has problems that prevent it from being merged. The PR will be closed tomorrow if there aren't new commits to fix the issues. |
@sandersn this PR is still pending work elsewhere (please read comments above) and should not be closed yet. Can you prevent @typescript-bot from doing so? |
@douglascayers To keep things tidy, we have to close PRs that aren't mergeable but don't have activity from their author. No worries, though - please open a new PR if you'd like to continue with this change. Thank you! |
That's unfortunate that @typescript-bot closed this in-progress pull request |
@DouglasAntunes I guess just rebase your branch when Jest is updated and recreate the PR sigh |
oops, sorry about the bot - we added support today to make sure it won't close if maintainers are still chatting DefinitelyTyped/dt-mergebot#33 |
Opening pull request per this conversation.
Please fill in this template.
npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).Select one of these and delete the others:
If changing an existing definition: