opened
julianvmodesto
username_0
### Versions of kyt, node, OS
kyt 0.3.0
node 6.9.1
macOS 10.11.6

### Bug or Feature?
bug

### Current Behavior

In a component, I have a `import '!style-loader!css-loader!./styles.css';` to import a set of styles globally.

In my component test, the error was thrown below.

```
Cannot find module '!style-loader!css-loader!./styles.css' from 'index.js'

      at Resolver.resolveModule (../node_modules/jest-resolve/build/index.js:144:17)
      ...
```
Looks like the Jest require resolver didn't pick up the existing `moduleNameMapper` config for css/scss below:

https://github.com/NYTimes/kyt/blob/d803c3e633d1c46b9fc1ee353502277b26feb76f/packages/kyt-core/config/jest.js#L12

### Desired Behavior

One fix would be to update the css/scss regex. Instead of `'^[./a-zA-Z0-9$_-]+\\.(css|scss)$'`, I modified my kyt.config.js with:

```
  modifyJestConfig: (baseConfig) => {
    const jestConfig = Object.assign({}, baseConfig);

    const styleStub = path.resolve(__dirname, 'node_modules', 'kyt', 'utils', 'jest', 'style.stub');
    jestConfig.moduleNameMapper = Object.assign({}, jestConfig.moduleNameMapper,
      {
        '\\.(css|scss)$': styleStub,
      }
    );

    return jestConfig;
  },
```
Jest moduleNameMappers don't match imports with specific Webpack loaders
issue
created
tizmagik
username_1
Good find. It's probably safe to change that regex, happy to review a PR with that!
comment
created
tizmagik
username_1
Closed in #363
comment
closed
tizmagik
username_1
issue