-
Notifications
You must be signed in to change notification settings - Fork 219
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
testing improvements #5774
testing improvements #5774
Conversation
patches/@endo+ses-ava+0.2.27.patch
Outdated
* propagating into `rawTest`. | ||
* | ||
- * @param {TesterInterface} avaTest | ||
+ * @param {import('ava').TestInterface} avaTest |
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.
Are we confident that our emulation satisfies the entire ava interface now? Or, is this a convenient fiction that improves the debug experience?
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.
You're right we don't. That's why this still returns TestInterface
. But the avaTest
param is indeed from Ava.
Marking this as Draft because my refactor broke some case.
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.
Confident now that it satisfies because it passes through whatever it doesn't override. I typed the param as generic so that it wraps whatever version of Ava was passed in.
@kriskowal why do we have a whitelist of what to allow through? shouldn't it be an "override" list that's passed over after copying everything? IIUC "ses-ava" package is to provide SES-happy console output, not for actual security of the test run. |
I should in this case defer to @erights, but this may have been born of abundance-of-caution or force-of-security-habit and eligible for a rethink. |
524e7de
to
5a3fc6a
Compare
I looked into the open issues for ses-ava and these would be solved by having the "override" list instead of an "allow" list: But I don't understand why this fence was put here! @erights ? I also don't know the symptoms of not using |
Also, since the
There are 36 of those. How about this instead?
|
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.
Since I see @kriskowal already approved, I'm changing my comments to Request changes as an interlock, even though it is still not R4R
Yeah, it isn't for security. It is to keep track of which methods we've examined to determine whether to augment them or not. Perhaps we should have two whitelists: The ones we know we want to augment, and the ones we know we don't. It is an interesting policy choice what to do with the remainder: Do we preserve their existing behavior (as your code does) until we decide, or do we omit them until we decide? |
Whether or not we mutate Also, wouldn't the first line of the latter still need to come first? If it does and still uses the ' |
The consequence is that the seeming console output is neither from the real console nor from the replacement that |
Ok good. So the purpose of the "ses-ava" package isn't for security, just to accommodate SES's console handling when testing with Ava.
I can't think of any reason to omit any part of the Ava test framework. The user shouldn't have to lose functionality because of SES's console requirements. (The lack of |
I think those are both offset by the value of consistent Ava tests, regardless of whether SES env is prepared. What's "related" is "prepare env" and when you prepare env or not, it should not change the ergonomics of writing a test. By bundling shims which have side effects with exports of symbols to use, I argue that this is more of a refactoring hazard.
Good question. The way the rule works, if you import without a symbol it's assumed to have side effects so it's exempt from ordering rules. Note that this PR isn't requesting the change. I asked to understand why it's like this in the first place and to see if we can agree on the proposed way. (I've since seen in PR history of Endo that it used to be the way I'm proposing.) If we do, I'll file a ticket to do that after MN-1. But my immediate goal with this PR is to make SES-Ava conform to the Ava API. |
cbcf9e5
to
ba710c0
Compare
I am ok with this, and with your other points above that I did not comment on. |
ba710c0
to
9410a85
Compare
9410a85
to
e9a7d03
Compare
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.
Approving in a rush as explained at #5774 (comment)
e9a7d03
to
200921a
Compare
200921a
to
3b5fd6c
Compare
Description
#5766 ran into a problem with
test.todo
not being available in ses-ava. 524e7de adds it. (fyi @erights )I also got fed up with this noise in test output. 295c8aa removes it.
Security Considerations
none
Documentation Considerations
--
Testing Considerations
Better