React-redux-starter-kit: includePath completely ignored by Karma?

Created on 9 Nov 2015  路  7Comments  路  Source: davezuko/react-redux-starter-kit

I've been trying to get node-bourbon to work with this starter-kit, but I can't manage to do so. It seems like the includePaths in build/webpack/_base.js is completely ignored by Karma.

I've isolated the issue in a separate repo:
https://github.com/inooid/react-redux-starter-kit-includePath-error

The bourbon mixins are fine in development mode, but once I try to run the tests, it cannot seem to load the bourbon file.

ERROR in ./~/css-loader!./~/autoprefixer-loader?browsers=last 2 version!./~/sass-loader!./src/styles/core.scss
Module build failed:
@import 'bourbon';
       ^
      File to import not found or unreadable: bourbon
      in /Users/boyddames/projects/nodejs/react-redux-starter-kit2/src/styles/core.scss (line 1, column 9)

Do you guys have any idea where to look?

bug

Most helpful comment

This is actually a regression since style imports should be ignored in the tests (and would have made this oversight moot). However, I think the problem can be solved without messing with any of that; it's probably because the webpack config in Karma doesn't include the full sass configuration. Try updating the webpack property in karma.js to include sassLoader:

    webpack : {
      devtool : 'inline-source-map',
      resolve : webpackConfig.resolve,
      plugins : webpackConfig.plugins
        .filter(plugin => !plugin.__KARMA_IGNORE__),
      module  : {
        loaders : webpackConfig.module.loaders
      },
      sassLoader : webpackConfig.sassLoader
    }

Does that work for you? I forked it and it appears to fix the issue. If so, I'll implement the fix in the core starter kit. Thanks for catching this.

All 7 comments

This is actually a regression since style imports should be ignored in the tests (and would have made this oversight moot). However, I think the problem can be solved without messing with any of that; it's probably because the webpack config in Karma doesn't include the full sass configuration. Try updating the webpack property in karma.js to include sassLoader:

    webpack : {
      devtool : 'inline-source-map',
      resolve : webpackConfig.resolve,
      plugins : webpackConfig.plugins
        .filter(plugin => !plugin.__KARMA_IGNORE__),
      module  : {
        loaders : webpackConfig.module.loaders
      },
      sassLoader : webpackConfig.sassLoader
    }

Does that work for you? I forked it and it appears to fix the issue. If so, I'll implement the fix in the core starter kit. Thanks for catching this.

Thank you so much @davezuko for the quick reply as well as fixing the issue :+1: :tada: ! It indeed works now!

How did you find the solution to this problem? I'm curious now haha :smile:

Awesome, glad that worked!

I don't remember when sass imports were un-ignored, but the breaking change came with this commit: https://github.com/davezuko/react-redux-starter-kit/commit/ef5f07b0022e876fbe9f9a0409d46312ebbc7f57, so basically I just remembered making that change and figured it probably had something to do with it.

Edit: the un-ignore part probably came all the way back when the Koa server was removed, and I just never caught it since there are no tests around components with sass imports (should probably get around to that).

Reopening until I pull the fix into master.

Added a test for CoreLayout with https://github.com/davezuko/react-redux-starter-kit/pull/175 to help catch potential future regressions.

@davezuko Thank you for your hard work on keeping this up-to-date! Really helped me out getting up and running!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jokeyrhyme picture jokeyrhyme  路  5Comments

dfalling picture dfalling  路  5Comments

postalservice14 picture postalservice14  路  4Comments

gilesbradshaw picture gilesbradshaw  路  5Comments

glifchits picture glifchits  路  3Comments