babel-plugin-angularjs-annotate icon indicating copy to clipboard operation
babel-plugin-angularjs-annotate copied to clipboard

Unit tests failing since `@babel/plugin-transform-classes` 7.16.5

Open AprilArcus opened this issue 3 years ago • 0 comments

Since@babel/plugin-transform-classes 7.16.5, seven unit tests are failing:

not ok 467 ES5: simple class
not ok 481 ES5: annotated class
not ok 482 ES5 explicitOnly: annotated class
not ok 489 ES5: annotated constructor
not ok 490 ES5 explicitOnly: annotated constructor
not ok 493 ES5: constructor with prologue directive
not ok 494 ES5 explicitOnly: constructor with prologue directive

I bisected the issue to this line diff in commit https://github.com/babel/babel/pull/12115/commits/acda1609e111973d87ae4e7438cfbc4182bb1ddb in the PR https://github.com/babel/babel/pull/12115

It looks like in ES5 mode, @babel/plugin-transform-classes transforms class declarations to function expressions (which are still recognized by babel-plugin-angularjs-annotate as annotation candidates), but following 7.16.5, these expressions are now wrapped in the _createClass() helper, which babel-plugin-angularjs-annotate does not recognize as eligible for annotation.

This issue would have been caught by the test suite with earlier versions of @babel/plugin-transform-classes if additional methods besides the constructor had been present in the test cases.

AprilArcus avatar Dec 07 '22 07:12 AprilArcus