Given a test suite that re-uses a jasmine spy and modifies the spy behavior:
import SomeLib from 'some-lib';
describe('My use case', () => {
let mySpy: jasmine.Spy;
beforeEach(() => {
mySpy = spyOn(SomeLib, 'doTheThing');
});
// test cases with default `callFake` behavior...
it('does something with modified spy behavior', () => {
mySpy.and.callThrough();
// ...
});
});
The jasmine-globals transformer will fail with a rather crpytic error Transformation error (Cannot read property 'length' of undefined), with the stack trace pointing to some recast internals.
The easiest reproduction is to add existingSpy.and.callThrough(); -> existingSpy; to this test case.
Given a test suite that re-uses a jasmine spy and modifies the spy behavior:
The
jasmine-globals
transformer will fail with a rather crpytic errorTransformation error (Cannot read property 'length' of undefined)
, with the stack trace pointing to some recast internals.The easiest reproduction is to add
existingSpy.and.callThrough();
->existingSpy;
to this test case.I will work on a fix.