stalniy/bdd-lazy-var

Maximum call stack size exceeded with named subjects

Visya opened this issue · 2 comments

Visya commented

Hi!
I stumbled upon an issue with named subjects, when named subject from child context attempts to access parent subject via subject().

describe('Test', function() {
  subject('parent', () => { name: 'test' });

  describe('Child', () => {
    subject('child', () => subject().name);

    it('equals parent name', () => {
      expect(subject()).to.equal('test');
    });
  });
});
0 passing (278ms)
1 failing

1) Test Child equals parent name:
   RangeError: Maximum call stack size exceeded

There is a workaround to not use a named subject as a child or to access parent by name.

subject('child', () => $parent.name);
subject(() => subject().name);

@Visya Could you please re-check in the latest master

Visya commented

@stalniy The issue appears to be fixed in master. Thanks