stalniy / bdd-lazy-var

Provides UI for testing frameworks such as mocha, jasmine and jest which allows to define lazy variables and subjects.
MIT License
162 stars 14 forks source link

Maximum call stack size exceeded because of accessing order in redefinition #20

Closed vonagam closed 7 years ago

vonagam commented 7 years ago

So this will fail:

describe( 'parent', () => {
  def( 'value', () => 1 );

  describe( 'child', () => {
    def( 'addition', () => 1 );
    def( 'value', () => $addition + $value );

    it( 'is two', () => expect( $value ).to.eq( 2 ) );
  } );
} );

If we change second value definition from $addition + $value to $value + $addition it will pass.

I don't know if this is a bug or this is how it is supposed to be. Feel free to close if this is not a problem. ( But then maybe it is good to have a note about this somewhere )

stalniy commented 7 years ago

Thanks for the issue. It's definitely a bug. I will check what is wrong there. Thanks for the report!

stalniy commented 7 years ago

fixed and published 1.3.0

vonagam commented 7 years ago

Thanks for the fix and for the library.