-
Notifications
You must be signed in to change notification settings - Fork 522
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: introduce generated_file_test #1941
Conversation
This is a new public API for checking in golden or snapshot files. If you used the private golden_file_test previously, you need to rename actual to generated, golden to src, and golden_debug to src_dbg Fixes bazel-contrib#1893
internal/generated_file_test/bin.js
Outdated
return 0; | ||
} | ||
if (mode === '--verify') { | ||
const unidiff = require('unidiff'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing needs to be done to ensure unidiff
is available?
I know the @bazel/*
npm packages use peerDependencies
, but how does it work for rules built directly into rules_nodejs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see @npm//unidiff
is passed into the nodejs_test|binary(data)
, but is that the consumers @npm//
and we assume the package exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Immediate answer is this needs some e2e test to show how it's used outside our workspace.
Yes I think that will show it's broken like you say. This rule has to be in an npm package or else unidiff has to be vendored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That could always be a followup, wouldn't change what you've done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌮
I like the naming you settled on
Add an example test for generated_file_test
@jbedard I added a second commit where I run rollup on the bin.js so unidiff gets inlined into the code. Added a test by simplifying the parcel example with a golden file rather than a spec, to prove that it works. |
This is a new public API for checking in golden or snapshot files.
If you used the private golden_file_test previously, you need to rename actual to generated, golden to src, and golden_debug to src_dbg
Fixes #1893