Skip to content

css-modules have inconsistent className hash using babel-plugin-webpack-loaders #1034

@chentsulin

Description

@chentsulin

Description

As title, test failed with AVA but passed with mocha.

Test Source

import test from 'ava';
import React from 'react';
import { shallow } from 'enzyme';

import Button from './Button';
import styles from './Button.css';

test('has hashed .btn className', t => {
  const element = shallow(<Button>Submit</Button>);
  const button = element.find('button');
  t.is(button.prop('className'), styles.btn);
})

Source Code

Error Message & Stack Trace

✖ has hashed .btn className   
  t.is(button.prop('className'), styles.btn)
              |                         |   
              "Button__btn___3T3BQ"     "Button__btn___2ZBj1"

2016-09-08 11 53 19

Config

{
  "ava": {
    "files": [
      "src/Button.ava.spec.js"
    ],
    "source": [
      "src/Button.js"
    ],
    "concurrency": 5,
    "failFast": true,
    "tap": false,
    "verbose": true,
    "require": [
      "babel-register"
    ],
    "babel": "inherit"
  }
}

Command-Line Arguments

NODE_ENV=test CONFIG=$(pwd)/webpack.config.test.js BABEL_DISABLE_CACHE=1 ava

Relevant Links

Environment

Node.js v6.2.0
darwin 15.2.0
ava 0.16.0
npm 3.8.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions