-
-
Notifications
You must be signed in to change notification settings - Fork 359
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: Add support for env.NYC_CONFIG_OVERRIDE #1077
Conversation
This allows a process to spawn a child process with an environment variable NYC_CONFIG_OVERRIDE. This is a JSON string which overrides any values in the NYC_CONFIG env. It is not deleted in the child process, so will be contagious unless unset, and it is the responsibility of the caller to manage. The first intended use case of this feature is to allow node-tap to map tests to the specific portion of a system under test that they cover. In this way, unit tests can be more focused, and only re-run when their specific unit has changed. There are, of course, many other uses that this could be put to, and it did not seem appropriate to add a special hook _just_ for overriding the include list.
@coreyfarrell #1078 removes some environs that are no longer load-bearing, if you're concerned about that. |
@isaacs I think removing unused environs in the next major release will be good but my concern is more about adding environmental variables which can be set from outside NYC to manipulate how it runs. |
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.
This is looking good to me, excited to see what you do with it.
Perhaps you can coordinate with @coreyfarrell (and his work here) to add the new tests as snapshots?
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 echo @coreyfarrell's concern but I don't feel strongly enough about it to block the merge.
I appreciate the approach of adding new test files for new features!
This allows a process to spawn a child process with an environment
variable NYC_CONFIG_OVERRIDE. This is a JSON string which overrides any
values in the NYC_CONFIG env. It is not deleted in the child process,
so will be contagious unless unset, and it is the responsibility of the
caller to manage.
The first intended use case of this feature is to allow node-tap to map
tests to the specific portion of a system under test that they cover.
In this way, unit tests can be more focused, and only re-run when their
specific unit has changed.
There are, of course, many other uses that this could be put to, and it
did not seem appropriate to add a special hook just for overriding
the include list.