Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors running with mochista #14

Open
laggingreflex opened this issue May 30, 2017 · 5 comments
Open

errors running with mochista #14

laggingreflex opened this issue May 30, 2017 · 5 comments

Comments

@laggingreflex
Copy link

I was trying this out (feature/mochista branch) to better understand that issue laggingreflex/mochista#12 but I'm getting these errors:

  mochista:log   Globing files... +0ms
  mochista:log   Readying watcher... +192ms
  mochista:warn  Timed out waiting for watcher "ready" event. Proceeding anyway... (See #chokidar issue in the README) +3s
  mochista:log   Loading compilers... +13ms
  mochista:log   Loading requires... +118ms
  mochista:log   Running mocha... +8s
Warning: ReactTestUtils has been moved to react-dom/test-utils. Update references to remove this warning.
  mochista:error Invariant Violation: injectTapEventPlugin(): Can only be called once per application lifecycle.
  mochista:error
  mochista:error It is recommended to call injectTapEventPlugin() just before you call ReactDOM.render(). If you are using an external library which calls injectTapEventPlugin() itself, please contact the maintainer as it shouldn't be called in library code and should be injected by the application.
  mochista:error ___Stack trace #1___
  mochista:error Invariant Violation: injectTapEventPlugin(): Can only be called once per application lifecycle.
  mochista:error
  mochista:error It is recommended to call injectTapEventPlugin() just before you call ReactDOM.render(). If you are using an external library which calls injectTapEventPlugin() itself, please contact the maintainer as it shouldn't be called in library code and should be injected by the application.
  mochista:error     at invariant (C:\...\webpack-react-typescript-boilerplate\node_modules\fbjs\lib\invariant.js:44:15)
  mochista:error     at injectTapEventPlugin (C:\...\webpack-react-typescript-boilerplate\node_modules\react-tap-event-plugin\src\injectTapEventPlugin.js:11:5)
  mochista:error     at Object.<anonymous> (C:\...\webpack-react-typescript-boilerplate\app\index.tsx:12:1)
  mochista:error     at Module._compile (module.js:571:32)
  mochista:error     at Module.m._compile (C:\...\webpack-react-typescript-boilerplate\node_modules\ts-node\src\index.ts:410:23)
  mochista:error     at Module._extensions..js (module.js:580:10)
  mochista:error     at Object.require.extensions.(anonymous function) [as .tsx] (C:\...\webpack-react-typescript-boilerplate\node_modules\ts-node\src\index.ts:413:12)
  mochista:error     at Module.load (module.js:488:32)
  mochista:error     at tryModuleLoad (module.js:447:12)
  mochista:error     at Function.Module._load (module.js:439:3)
  mochista:error     at Module.require (module.js:498:17)
  mochista:error     at require (internal/module.js:20:19)
  mochista:error     at C:\...\mochista\node_modules\mocha\lib\mocha.js:230:27
  mochista:error     at Array.forEach (native)
  mochista:error     at Mocha.loadFiles (C:\...\mochista\node_modules\mocha\lib\mocha.js:227:14)
  mochista:error     at Mocha.run (C:\...\mochista\node_modules\mocha\lib\mocha.js:495:10) +14s

Commenting out https://github.com/el-davo/webpack-react-typescript-boilerplate/blob/feature/mochista/app/index.tsx#L12 got rid of the above error but then the following error occurred:

  mochista:log   Globing files... +0ms
  mochista:log   Readying watcher... +222ms
  mochista:warn  Timed out waiting for watcher "ready" event. Proceeding anyway... (See #chokidar issue in the README) +4s
  mochista:log   Loading compilers... +20ms
  mochista:log   Loading requires... +198ms
  mochista:log   Running mocha... +10s
Warning: ReactTestUtils has been moved to react-dom/test-utils. Update references to remove this warning.
action %c@@router/LOCATION_CHANGE %c@ 22:58:56.063
action %c@@router/LOCATION_CHANGE %c@ 22:58:56.063
  mochista:error TypeError: logger[prevStateLevel] is not a function
  mochista:error ___Stack trace #1___
  mochista:error TypeError: logger[prevStateLevel] is not a function
  mochista:error     at C:\...\webpack-react-typescript-boilerplate\node_modules\redux-logger\lib\core.js:116:51
  mochista:error     at Array.forEach (native)
  mochista:error     at printBuffer (C:\...\webpack-react-typescript-boilerplate\node_modules\redux-logger\lib\core.js:69:10)
  mochista:error     at C:\...\webpack-react-typescript-boilerplate\node_modules\redux-logger\lib\index.js:117:31
  mochista:error     at C:\...\webpack-react-typescript-boilerplate\node_modules\react-router-redux\lib\middleware.js:22:18
  mochista:error     at C:\...\webpack-react-typescript-boilerplate\node_modules\redux-saga\lib\internal\middleware.js:86:22
  mochista:error     at Object.dispatch (C:\...\webpack-react-typescript-boilerplate\node_modules\redux-immutable-state-invariant\dist\index.js:52:32)
  mochista:error     at handleLocationChange (C:\...\webpack-react-typescript-boilerplate\node_modules\react-router-redux\lib\sync.js:99:11)
  mochista:error     at Object.syncHistoryWithStore (C:\...\webpack-react-typescript-boilerplate\node_modules\react-router-redux\lib\sync.js:108:5)
  mochista:error     at Object.<anonymous> (C:\...\webpack-react-typescript-boilerplate\app\index.tsx:15:17)
  mochista:error     at Module._compile (module.js:571:32)
  mochista:error     at Module.m._compile (C:\...\webpack-react-typescript-boilerplate\node_modules\ts-node\src\index.ts:410:23)
  mochista:error     at Module._extensions..js (module.js:580:10)
  mochista:error     at Object.require.extensions.(anonymous function) [as .tsx] (C:\...\webpack-react-typescript-boilerplate\node_modules\ts-node\src\index.ts:413:12)
  mochista:error     at Module.load (module.js:488:32)
  mochista:error     at tryModuleLoad (module.js:447:12) +13s

Any idea why these errors might be occurring, or is it only at my end? I'm on Windows 10

@el-davo
Copy link
Owner

el-davo commented May 30, 2017

Hi @laggingreflex thanks for opening this one. I cant seem to reproduce it on my end, im also on windows 10. Can you confirm that you installed all the npm dependencies with yarn? Can you also confirm that the following scripts run correctly.

npm test
npm run test:watch
npm run coverage

@el-davo
Copy link
Owner

el-davo commented Jun 6, 2017

hi @laggingreflex I took a closer look.

TLDR The issue is , you can re-pull and it should work

The issue was that because I am including test-setup.ts it is calling injectTapEventPlugin(). index.tsx is also calling this and this seems to be a violation as it should only be called once. For the moment i have exluded index.tsx from source files with --source-files-exclude=./app/index.tsx. This is probably better as it was trying to load up the whole app. Let me know if there are still issues

@el-davo
Copy link
Owner

el-davo commented Jun 29, 2017

Closing due to inactivity, please feel free to re-open and we can take another crack at this, in the meantime im happy to proceed without mochista

@el-davo el-davo closed this as completed Jun 29, 2017
@laggingreflex
Copy link
Author

The error was due to mochista not being able to parse correctly the mocha.opts file (as I myself suggested here), and I think I've since fixed it (probably in laggingreflex/mochista@8c8070f) but other than it did end up working in the end.

@el-davo
Copy link
Owner

el-davo commented Jun 29, 2017

Nice!, Will take another look when i get some free time

@el-davo el-davo reopened this Jun 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants