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

test(toolkit): watch tests #33040

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

test(toolkit): watch tests #33040

wants to merge 1 commit into from

Conversation

kaizencc
Copy link
Contributor

tests for watch


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the p2 label Jan 21, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team January 21, 2025 22:26
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 21, 2025
Comment on lines +160 to +161
fakeChokidarWatcherOn.readyCallback();
await new Promise(resolve => setTimeout(resolve, 3000));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm frustrated but this is all i can think of at the moment. the problem is this:

  1. the right thing to do here is to mock toolkit.deploy but that just... doesn't work.
const mockDeploy = jest.fn();
toolkit.deploy = mockDeploy;
expect(mockDeploy).toHaveBeenCalled();

I can see that toolkit.deploy is called normally, and then not called when it is mocked. But jest refuses to show that mockDeploy has been called.

  1. in the current state of things, fakeChokidaorWatcherOn.readyCallback() triggers watch to in turn invoke deploy. But that all happens asynchronously, and ioHost.notifySpy does not get the right messages since there's nothing to await. Just waiting for 3 seconds cannot be the best thing to do here, but my gut tells me that we want to figure out how to do 1), and then this point will be moot

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: a55ecd8
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.49%. Comparing base (61e876b) to head (a55ecd8).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #33040   +/-   ##
=======================================
  Coverage   81.49%   81.49%           
=======================================
  Files         224      224           
  Lines       13755    13755           
  Branches     2413     2413           
=======================================
  Hits        11209    11209           
  Misses       2273     2273           
  Partials      273      273           
Flag Coverage Δ
suite.unit 81.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 80.85% <ø> (ø)
packages/aws-cdk-lib/core 82.15% <ø> (ø)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants