jest-codemods
jest-codemods copied to clipboard
Ava contexts not transformed
test.beforeEach(t => {
t.context.fn = () => 'foo';
});
test('will execute foo', t => {
t.is(t.context.fn(), 'foo');
});
The t.is will be modified, but the t.context will be left in place and cause errors. Perhaps renaming and moving to the file closure would work.
https://github.com/avajs/ava#test-context
Thanks for reporting this. Let me know if you would like to try to fix it. : )
I ran into this issue as well. The easiest fix was to add this at the beginning:
const t = { context: { fn: null } }
test.beforeEach(t => {
t.context.fn = () => 'foo';
});
test('will execute foo', t => {
t.is(t.context.fn(), 'foo');
});