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

chore: migrate aws-cdk from nodeunit to jest #5659

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

RomainMuller
Copy link
Contributor

There is some interesting magic happening around the runtime-info
module: jest replaces the standard require function so it can honor
module mocking requirements, however this does (intentionally) not
implement require.cache, which is used to determine which CDK
libraries are loaded during a particular execution (in order to populate
the AWS::CDK::Metadata resource as needed).

In order to work around this, the require.cache reading was indirected
through a proxy module, so it can be stubbed, too, with a pretend cache
content, in order to make the test still workable.


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

There is some interesting magic happening around the runtime-info
module: `jest` replaces the standard `require` function so it can honor
module mocking requirements, however this does (intentionally) not
implement `require.cache`, which is used to determine which CDK
libraries are loaded during a particular execution (in order to populate
the `AWS::CDK::Metadata` resource as needed).

In order to work around this, the `require.cache` reading was indirected
through a proxy module, so it can be stubbed, too, with a pretend cache
content, in order to make the test still workable.
@RomainMuller RomainMuller self-assigned this Jan 6, 2020
@RomainMuller RomainMuller added the ops-excellence Operational Excellence label Jan 6, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 6, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@@ -103,5 +99,23 @@
"engines": {
"node": ">= 10.3.0"
},
"stability": "stable"
"stability": "stable",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this duplicated configuration everywhere? For example the reporter types should be the same for all modules!

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

My assumption is that no tests were removed during this transition. Otherwise it’s impossible to review.

@mergify
Copy link
Contributor

mergify bot commented Jan 6, 2020

Thank you for contributing! Your pull request is now being automatically merged.

@mergify mergify bot merged commit 59cbdc0 into master Jan 6, 2020
@mergify mergify bot deleted the rmuller/nodeunit-to-jest/aws-cdk branch January 6, 2020 11:50
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. ops-excellence Operational Excellence
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants