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: added snapshot tests #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

test: added snapshot tests #7

wants to merge 2 commits into from

Conversation

abdul99ahad
Copy link
Contributor

Proposed Changes

This PR aims to add snapshot tests.

  • before and after webpack plugin applies
  • can't run without loader / rules if no plugin applies
  • should have alias when plugin applies
  • you can apply custom rules
    • can work with plugins
    • can work without plugins

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Mar 12, 2025
@nikku
Copy link
Member

nikku commented Mar 12, 2025

Not sure if we have different expectations on "snapshot tests", let me share mine:

  • A snapshot test is when we, at one point in time, generate a snapshot "the expected shape" of a result
  • As we progress in time, we validate new generations of the thing against the snapshot, to ensure that new generations comply with old expectations.

What you seem to do here, if I understand correctly, is to compare different "runs" for equality. Also a testing strategy, but I'm not sure what that one should accomplish. :)

@abdul99ahad
Copy link
Contributor Author

What is the "expected shape" here. A custom plugin with webpack plugin config support?

@nikku
Copy link
Member

nikku commented Mar 12, 2025

Expected shape is "result of a webpack run with the plug-in enabled".

@nikku
Copy link
Member

nikku commented Mar 12, 2025

Regarding "what is snapshot testing", this may help. Let's discuss tomorrow.

@abdul99ahad
Copy link
Contributor Author

Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly. (ref. https://jestjs.io/docs/snapshot-testing)

Looking at the PR #8, I now understand what we wanted to accomplish. There are two parts:

  1. usage of webpack plugin when applied to plugins and when not applied (PR test: added snapshot tests #7)
  2. plugins that uses webpack-plugin for bundling (PR Housekeeping + improve tests #8)

What you seem to do here, if I understand correctly, is to compare different "runs" for equality. Also a testing strategy, but I'm not sure what that one should accomplish. :)

This accomplishes runs of plugins that bundled using webpack plugin and without webpack plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Review pending
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants