-
Notifications
You must be signed in to change notification settings - Fork 579
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
SPIKE: Determine if AVA test framework can be used with SES #1003
Comments
After some research it is confirmed that SES can be used with the AVA test runner. SES notes:There are some lockdown({ domainTaming: 'unsafe', errorTaming: 'unsafe' }); Otherwise, SES would be throwing an error related to the domains:
Given that the Testing code that use SES functions:In order to test code that is using SES functions, such as AVA notes:Because of the different nature of Example and comparison of the tests in Jest and AVA respectively: it('teardownFunction should clear timeouts', async () => {
const { setTimeout: _setTimeout, teardownFunction } = timeout.factory();
expect(
await new Promise((resolve, reject) => {
_setTimeout(reject, 100);
teardownFunction();
setTimeout(resolve, 200);
}),
).toBeUndefined();
}, 300); AVA: test('teardownFunction should clear timeouts', async (t) => {
const { setTimeout: _setTimeout, teardownFunction } = timeout.factory();
const result = await new Promise((resolve, reject) => {
_setTimeout(reject, 100);
teardownFunction();
setTimeout(resolve, 200);
});
t.is(result, undefined);
}); Code example of importing // eslint-disable-next-line import/no-unassigned-import
import 'ses';
import test from 'ava';
test.before(() => {
lockdown({ domainTaming: 'unsafe', errorTaming: 'unsafe' });
}); Other notesTest conversion strategy is to be determined. |
Since the research on the topic was completed and there are no additional inputs from the team, I'm closing this ticket. The related work will be followed within the epic: #585 |
Determine if AVA test framework can be used to test code which includes SES functions.
It is found that the Jest test framework does not work with SES. That makes impossible to test code that includes SES functions such as
harden({...})
.Given that the Jest is used in the
snaps-execution-environments
package it is not possible to continue with a ticket for hardening all endowments, so the research is needed in order to replace the test framework in the package mentioned.Related tickets:
#585
The text was updated successfully, but these errors were encountered: