small medium large xlarge

Generic-user-small
20 Sep 2017, 00:35
Joel (7 posts)

Trying to follow the configuration setup for “Writing Unit Tests for Angular Components” section of the book and in my install using the latest webpacker gem(3.0) there is no shared.js file. I poked around but can’t figure out where I need to add the config that the books states should be in this missing file.

Generic-user-small
21 Sep 2017, 00:54
Joel (7 posts)

After looking at the webpacker gem update info on the rails blog it seems they moved a lot of the config into the npm package so I’m not sure how this can be resolved. Without adding the config but setting the rest up I get this error:

~~~

Running via Spring preloader in process 25140 $(yarn bin)/karma start spec/javascript/karma.conf.js –single-run –log-level=error –fail-on-empty-test-suite ts-loader: Using typescript@2.5.2 and /Users/compost/Source/Go-Tournament-Manager/tsconfig.json PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 0 ERROR (0.001 secs / 0 secs) rake aborted! Command failed with status (1): [$(yarn bin)/karma start spec/javascript/ka…] /Users/compost/Source/Go-Tournament-Manager/lib/tasks/karma.rake:4:in block in <top (required)>' -e:1:in ' Tasks: TOP => karma (See full trace by running task with --trace)

~~~

Dmfcb_pragsmall
20 Sep 2017, 22:04
David Copeland (488 posts)

Can you format the error message? It’s hard to see what is actually happening.

And, yeah, webpacker 3 basically blew that part up :(

Does it work with Webpacker 2?

And, if you can post a link to your repo I can maybe check it out

Generic-user-small
21 Sep 2017, 00:56
Joel (7 posts)

not sure how to format the error message but here is my repo

Dmfcb_pragsmall
21 Sep 2017, 12:33
David Copeland (488 posts)

Hmm, looks like you aren’t doing the book’s example app. That’s gonna be harder for me to debug. Did Webpacker 2 work? you’d need to remove what webpack 3 did and re-run the installation stuff.

To try getting it to work with the webpacker 3 setup, this shows somewhat how: https://github.com/rails/webpacker/blob/master/docs/webpack.md but it’s not specific to what the book is telling you to do in shared.js.

The reason to poke around in there at all is to fix a weird issue with Karma and Webpack. Do things work without trying to do that? Again, sorry it’s hard to tell from what you’ve posted what is happening. The error message is jumbled and has a lot of information elided. It looks like it’s pointing you to a line in a rakefile, but hard to tell.

Generic-user-small
22 Sep 2017, 00:50
Joel (7 posts)

Added a config/webpack/karma.js file to deal with the issue and using: ```const { module: m, resolve, resolveLoader } = require(‘./test’);

module.exports = { module: m, resolve, resolveLoader, devtool: ‘inline-source-map’ }; ```

You must be logged in to comment