Open mongoose700 opened 3 years ago
We found this occurred specifically in our CI environment, when CI=true
Some starting points for investigation
CI flags look to be used here https://github.com/emberjs/ember-cli-babel/blob/b61e71bfa923fc3d9aca9c3639ed6946e7ba8c68/lib/ember-plugins.js#L12 https://github.com/emberjs/ember-cli-babel/blob/b61e71bfa923fc3d9aca9c3639ed6946e7ba8c68/lib/babel-options-util.js#L66
From https://github.com/ember-cli/babel-plugin-debug-macros/tree/master
The assert macro can expand in a more intelligent way with the correct configuration. When babel-plugin-debug-macros is provided with the assertPredicateIndex the predicate is injected in front of the assertion in order to avoid costly assertion message generation when not needed.
Looks like it has been reported over there as an issue https://github.com/ember-cli/babel-plugin-debug-macros/issues/89
If I start with this code
it gets transformed into
The first check for
!(_foo$bar.baz)
is performed before the(_foo$bar = foo.bar)
assignment, which means it will always throw an error, regardless of the actual value.