nwb icon indicating copy to clipboard operation
nwb copied to clipboard

Fresh component, tests fail with error from is-equals

Open mccalluc opened this issue 4 years ago • 0 comments

This issue is a:

  • Bug report

SUMMARY

A fresh nwb new react-component my-component, followed by pasting in the example test produces errors:

$ npm run test

> [email protected] test /Users/chuck/github/hubmap/my-component
> nwb test-react


START:
(node:39137) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
Failed to compile with 4 errors.

 ERROR  in ./node_modules/is-map/index.js 12:1
Module parse failed: 'return' outside of function (12:1)
You may need an appropriate loader to handle this file type.
| 		return false;
| 	};
> 	return;
| }
|
 @ ./node_modules/es-get-iterator/index.js 122:14-31
 @ ./node_modules/is-equal/why.js
 @ ./node_modules/expect/lib/TestUtils.js
 @ ./node_modules/expect/lib/Expectation.js
 @ ./node_modules/expect/lib/index.js
 @ ./src/simple.test.js

 ERROR  in ./node_modules/is-set/index.js 12:1
Module parse failed: 'return' outside of function (12:1)
You may need an appropriate loader to handle this file type.
| 		return false;
| 	};
> 	return;
| }
|
 @ ./node_modules/es-get-iterator/index.js 123:14-31
 @ ./node_modules/is-equal/why.js
 @ ./node_modules/expect/lib/TestUtils.js
 @ ./node_modules/expect/lib/Expectation.js
 @ ./node_modules/expect/lib/index.js
 @ ./src/simple.test.js

 ERROR  in ./node_modules/is-weakmap/index.js 12:1
Module parse failed: 'return' outside of function (12:1)
You may need an appropriate loader to handle this file type.
| 		return false;
| 	};
> 	return;
| }
|
 @ ./node_modules/which-collection/index.js 5:16-37
 @ ./node_modules/is-equal/why.js
 @ ./node_modules/expect/lib/TestUtils.js
 @ ./node_modules/expect/lib/Expectation.js
 @ ./node_modules/expect/lib/index.js
 @ ./src/simple.test.js

 ERROR  in ./node_modules/is-weakset/index.js 12:1
Module parse failed: 'return' outside of function (12:1)
You may need an appropriate loader to handle this file type.
| 		return false;
| 	};
> 	return;
| }
|
 @ ./node_modules/which-collection/index.js 6:16-37
 @ ./node_modules/is-equal/why.js
 @ ./node_modules/expect/lib/TestUtils.js
 @ ./node_modules/expect/lib/Expectation.js
 @ ./node_modules/expect/lib/index.js
 @ ./src/simple.test.js
09 12 2019 15:07:39.325:INFO [karma]: Karma v2.0.5 server started at http://0.0.0.0:9876/
09 12 2019 15:07:39.326:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
09 12 2019 15:07:39.349:INFO [launcher]: Starting browser PhantomJS
09 12 2019 15:07:40.286:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket qTIcnFsUNOIl6ljaAAAA with id 50514941
09 12 2019 15:07:40.466:WARN [reporter]: SourceMap position not found for trace: {
  "message": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat http://localhost:9876/base/src/simple.test.js?4d5696dc68110bd4c817a935bd6a14aab65aedce:4346:189",
  "str": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat http://localhost:9876/base/src/simple.test.js?4d5696dc68110bd4c817a935bd6a14aab65aedce:4346:189"
}
09 12 2019 15:07:40.467:WARN [reporter]: SourceMap position not found for trace: {
  "message": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat http://localhost:9876/base/src/simple.test.js?4d5696dc68110bd4c817a935bd6a14aab65aedce:4346:189",
  "str": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat http://localhost:9876/base/src/simple.test.js?4d5696dc68110bd4c817a935bd6a14aab65aedce:4346:189"
}
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
  {
    "message": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat src/simple.test.js:4346:189",
    "str": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat src/simple.test.js:4346:189"
  }

Finished in 0.183 secs / 0 secs @ 15:07:40 GMT-0500 (Eastern Standard Time)

SUMMARY:
✔ 0 tests completed
09 12 2019 15:07:40.559:WARN [reporter]: SourceMap position not found for trace: {
  "message": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat http://localhost:9876/base/tests/index-test.js?4755a8c461b25b396eab34c04066478253bbe8df:4346:189",
  "str": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat http://localhost:9876/base/tests/index-test.js?4755a8c461b25b396eab34c04066478253bbe8df:4346:189"
}
09 12 2019 15:07:40.559:WARN [reporter]: SourceMap position not found for trace: {
  "message": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat http://localhost:9876/base/tests/index-test.js?4755a8c461b25b396eab34c04066478253bbe8df:4346:189",
  "str": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat http://localhost:9876/base/tests/index-test.js?4755a8c461b25b396eab34c04066478253bbe8df:4346:189"
}
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
  {
    "message": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat tests/index-test.js:4346:189",
    "str": "Error: Module parse failed: 'return' outside of function (12:1)\nYou may need an appropriate loader to handle this file type.\n| \t\treturn false;\n| \t};\n> \treturn;\n| }\n| \nat tests/index-test.js:4346:189"
  }

✖ Error while running the tests! Exit code: 1

Karma exit code was 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `nwb test-react`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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!     /Users/chuck/.npm/_logs/2019-12-09T20_07_40_596Z-debug.log

Pinning is-equal at 1.6.0 allows tests to pass.

(Cross-reference: I had first raised an issue at https://github.com/inspect-js/is-equal/issues/65, but the problem is not there.)

REPRO REPOS

https://github.com/mccalluc/nwb-test-bug-reproducer demonstrates the problem: Out of the box, tests fail: See aca16a59... but pinning is-equal gets tests to pass; See e83f707d.

Is the version of nwb you're using installed globally or locally?

  • globally

Which versions of Node.js, npm and nwb are you using (if using it globally)?

$ node -v
v10.17.0
$ npm -v
6.11.3
$ nwb -v
v0.23.0

Which modules are installed in your project?

# This is the working state, with is-equal pinned.
$ npm ls --depth=0
[email protected] /Users/chuck/github/hubmap/my-component
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

mccalluc avatar Dec 09 '19 20:12 mccalluc