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

feat(tests): add snapshot tests for all test projects #114

Merged
merged 4 commits into from Dec 4, 2023

Conversation

eoinsha
Copy link
Contributor

@eoinsha eoinsha commented Nov 29, 2023

Add snapshot tests for all test projects

Description

  • Added snapshot tests for serverless-test-project-*, cdk-test-project, sam-test-project

Motivation and Context

  • Unit test coverage is better now but regressions can be missed
  • Allows us to detect valid and invalid deviations in generate templates, logical IDs, etc.

How Has This Been Tested?

  • Self-tested only

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@coveralls
Copy link

coveralls commented Nov 29, 2023

Coverage Status

coverage: 99.971% (-0.03%) from 100.0%
when pulling 6e98ebb on add-snapshot-testing
into 049c205 on main.

@eoinsha eoinsha marked this pull request as ready for review December 1, 2023 09:29
Copy link
Contributor

@dlynam01 dlynam01 left a comment

Choose a reason for hiding this comment

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

Couple of minor comments

@@ -6,7 +6,8 @@ import { setLogger } from 'slic-watch-core/logging'
import { type SlicWatchConfig, resolveSlicWatchConfig } from 'slic-watch-core/inputs/general-config'
import { type Template } from 'cloudform-types'

const logger = pino({ name: 'macroHandler' })
const logger = pino({ name: 'macroHandler', level: process.env.DEBUG_LEVEL ?? 'DEBUG' })
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want the default debug level to be DEBUG

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it keeps the status quo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, exactly. I think it's useful to have the input and output stack visible in the Macro function's logs but want to suppress it during test runs.

test-utils/sls-test-utils.ts Outdated Show resolved Hide resolved
Co-authored-by: David Lynam <david.lynam@fourtheorem.com>
Copy link
Collaborator

@direnakkoc direnakkoc left a comment

Choose a reason for hiding this comment

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

LGTM!
I was only trying to look into how to generate the template from CDK, SAM, and Serverless framework automatically rather than manually creating JSON output of CloudFormation Template.

@eoinsha eoinsha merged commit 2a063f0 into main Dec 4, 2023
1 of 3 checks passed
@eoinsha eoinsha deleted the add-snapshot-testing branch December 4, 2023 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants