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

Add support for snapshot testing #1142

Open
jason0x43 opened this issue Apr 14, 2020 · 0 comments
Open

Add support for snapshot testing #1142

jason0x43 opened this issue Apr 14, 2020 · 0 comments
Labels
effort-high This will take a while enhancement A new or improved feature priority-medium This should get done, but it's not a high priority

Comments

@jason0x43
Copy link
Member

Intern should have built-in support for snapshot testing for serializable data values. The goal would be for Intern to record values (any JSON-serializable value, like React render trees) to files and provide a way to easily update them.

The simplest API would probably be to create or use an existing chai plugin, something like chai-karma-snapshot or mocha-chai-snapshot. This would give us an API like:

assert.matchesSnapshot(value);
expect(value).to.matchSnapshot();

Intern should have two functions accessible via the CLI: a way to update snapshots, and a way to prune them (delete any that are no longer relevant). On the config side, these could live under a snapshots property:

{
  "snapshots": {
    "update": true
  }
}

From the command line, using the current option format in Intern master, the above config could be temporarily enabled with --snapshots-update.

@jason0x43 jason0x43 added enhancement A new or improved feature effort-high This will take a while priority-medium This should get done, but it's not a high priority labels Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort-high This will take a while enhancement A new or improved feature priority-medium This should get done, but it's not a high priority
Projects
None yet
Development

No branches or pull requests

1 participant