openlayers / babel-plugin-jsdoc-closure

Transpiles JSDoc types from namepaths to types for Closure Compiler
MIT License
5 stars 3 forks source link

Tests errors when updating recast to 0.15.0 #1

Open fredj opened 6 years ago

fredj commented 6 years ago

When updating recast to ^ 0.15.0:

--- a/package.json
+++ b/package.json
@@ -22,7 +22,7 @@
     "eslint": "^4.17.0",
     "eslint-config-openlayers": "^9.0.0",
     "mocha": "^5.0.0",
-    "recast": "^0.13.0"
+    "recast": "^0.15.0"
   },
   "dependencies": {
     "comment-parser": "^0.5.0"

The following error are raised ba npm run test:


> babel-plugin-jsdoc-closure@1.5.1 test /home/fredj/code/babel-plugin-jsdoc-closure
> npm run lint && mocha

> babel-plugin-jsdoc-closure@1.5.1 lint /home/fredj/code/babel-plugin-jsdoc-closure
> eslint index.js test/

  babel-plugin-jsdoc-closure
    ✓ transforms a type with an imported module (86ms)
    ✓ transforms a type cast with an imported module in a return statement
    ✓ transforms an object property type cast with an imported module in a return statement
    ✓ transforms a type with an imported default export
    ✓ transforms a type with an imported named export
    ✓ transforms an enum imported as default export
    ✓ transforms a type with a JSDoc module path
    ✓ transforms a type with type application of module paths
    ✓ resolves path correctly for index.js files
    ✓ replaces module type in a compound type
    ✓ replaces module type in a nested type
    ✓ replaces module type in an optional param
    ✓ replaces module type in an non nullable param
    1) exports typedefs
    2) turns Object typedefs into structural interfaces

  13 passing (195ms)
  2 failing

  1) babel-plugin-jsdoc-closure
       exports typedefs:

      AssertionError [ERR_ASSERTION]: '/** @module module2/types */\n/** @typedef {number} */\nexport let Foo;\n' == '/** @module module2/types */\n/** @typedef {number} */\nexport let Foo;'
      + expected - actual

       /** @module module2/types */
       /** @typedef {number} */
      -export let Foo;
      +export let Foo;

      at test (test/test.js:24:12)
      at Context.<anonymous> (test/test.js:203:5)

  2) babel-plugin-jsdoc-closure
       turns Object typedefs into structural interfaces:

      AssertionError [ERR_ASSERTION]: '/** @module module2/types */\n/** @interface */\nexport function Foo() {}\n\n/** @type {(!../module1/Bar)} */\nFoo.prototype.ba == '/** @module module2/types */\n/** @interface */\nexport function Foo() {}\n\n/** @type {(!../module1/Bar)} */\nFoo.prototype.ba
      + expected - actual

       /** @type {(!../module1/Bar)} */
       Foo.prototype.bar;

       /** @type {(undefined|number)} */
      -Foo.prototype.baz;
      +Foo.prototype.baz;

      at test (test/test.js:24:12)
      at Context.<anonymous> (test/test.js:216:5)

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! babel-plugin-jsdoc-closure@1.5.1 test: `npm run lint && mocha`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the babel-plugin-jsdoc-closure@1.5.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fredj/.npm/_logs/2018-06-12T07_24_05_022Z-debug.log
fredj commented 6 years ago

It's only a missing \n at the end of the file