gowravshekar / font-awesome-webpack

font-awesome package for webpack
MIT License
192 stars 49 forks source link

Unit Testing: Crashing in Mocha? #28

Open markpassando opened 7 years ago

markpassando commented 7 years ago

I've got this to work great with the browser but I am having problems with Unit Testing.

I am new to unit testing and Mocha. I may be missing something related to that but I am testing React with Redux containers with webpack and Mocha.

The import of font-awesome-webpack will throw me this error. import 'font-awesome-webpack'; I have tested a few components and containers but any of them using that import line will throw me this error. If I comment the import line out, the code will pass perfectly. The error is below.

Error: Cannot find module 'style!css!less!./font-awesome-styles!./font-awesome.config.js' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (c:\react\weather\node_modules\font-awesome-webpack\index.js:1:1) at Module._compile (module.js:409:26) at Module._extensions..js (module.js:416:10) at Object.require.extensions.(anonymous function) [as .js] (c:\react\weather\node_modules\babel-core\node_modules\babel-register\lib\node.js:152:7) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (c:/react/weather/src/components/app.js:6:1) at Module._compile (module.js:409:26) at loader (c:\react\weather\node_modules\babel-core\node_modules\babel-register\lib\node.js:144:5) at Object.require.extensions.(anonymous function) [as .js] (c:\react\weather\node_modules\babel-core\node_modules\babel-register\lib\node.js:154:7) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (c:/react/weather/test/components/app_test.js:2:1) at Module._compile (module.js:409:26) at loader (c:\react\weather\node_modules\babel-core\node_modules\babel-register\lib\node.js:144:5) at Object.require.extensions.(anonymous function) [as .js] (c:\react\weather\node_modules\babel-core\node_modules\babel-register\lib\node.js:154:7) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at c:\react\weather\node_modules\mocha\lib\mocha.js:222:27 at Array.forEach (native) at Mocha.loadFiles (c:\react\weather\node_modules\mocha\lib\mocha.js:219:14) at Mocha.run (c:\react\weather\node_modules\mocha\lib\mocha.js:487:10) at loadAndRun (c:\react\weather\node_modules\mocha\bin\_mocha:415:22) at rerun (c:\react\weather\node_modules\mocha\bin\_mocha:443:5) at c:\react\weather\node_modules\mocha\bin\_mocha:451:7 at StatWatcher.<anonymous> (c:\react\weather\node_modules\mocha\lib\utils.js:195:9) at emitTwo (events.js:87:13) at StatWatcher.emit (events.js:172:7) at StatWatcher._handle.onchange (fs.js:1290:10)

I appreciate any help. Thanks!

wolfadex commented 7 years ago

Are you using webpack 2? If so this should be resolved by #23.