Skip to content

chore: migrate all remaining modules from NodeUnit to Jest#16585

Merged
mergify[bot] merged 6 commits intoaws:masterfrom
kaizencc:jest-migrate-3
Sep 22, 2021
Merged

chore: migrate all remaining modules from NodeUnit to Jest#16585
mergify[bot] merged 6 commits intoaws:masterfrom
kaizencc:jest-migrate-3

Conversation

@kaizencc
Copy link
Copy Markdown
Contributor

@kaizencc kaizencc commented Sep 21, 2021

Migrates aws-cloudformation, cfnspec, and aws-codebuild to jest.

In aws-cloudformation, jest does not like the idea of nested tests; however, as the scope of this PR is to migrate, I have added eslint-ignore to the relevant lines. The linter error in question is valid-describe.


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

@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Sep 21, 2021

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 21, 2021
@kaizencc kaizencc requested a review from nija-at September 21, 2021 20:52
@skinny85 skinny85 changed the title chore: migrate all remaining modules from nodeunit to jest chore: migrate all remaining modules from NodeUnit to Jest Sep 21, 2021
});

// eslint-disable-next-line jest/valid-describe
describe('resource in nested stack depends on a resource in the parent stack', matrixForResourceDependencyTest((addDep) => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

jest/valid-describe. It appears that the describe callback function should not contain any return statement or parameters. I am not actually sure which is the error here as matrixForResourceDependencyTest does return () => {}. However, the actual function does have both a return statement and parameters, which may be what is causing the error.

At any rate, I think that this is a valid way to utilize describe with as much fidelity as possible, and the underlying tests work as expected. Just want a second pair of eyes here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, I think this is fine. As long as the test and the assertions are run, this doesn't matter so much!

global: {
statements: 70,
branches: 50,
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These thresholds are very low, so I investigated. The original nodeunit tests claim to cover 84% statements and 62% branches. However, for some reason nodeunit was ignoring code under the build-tools folder, of which there is only 1 test (under build.test.ts). For the rest of the module, the coverage data shows that the original nodeunit tests cover the same lines as the migrated jest tests.

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 22, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: ab72984
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit d03b586 into aws:master Sep 22, 2021
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 22, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@kaizencc kaizencc deleted the jest-migrate-3 branch October 13, 2021 16:40
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants