css-modules have inconsistent className hash using babel-plugin-webpack-loaders
See original GitHub issueDescription
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);
})
Error Message & Stack Trace
✖ has hashed .btn className
t.is(button.prop('className'), styles.btn)
| |
"Button__btn___3T3BQ" "Button__btn___2ZBj1"
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
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:13 (6 by maintainers)
Top Results From Across the Web
babel-plugin-react-css-modules does not change class name ...
Rant: One of the many reasons I'm against the create-react-app (CRA) is because of how inflexible it can be when it comes to...
Read more >Class name does not match style name with babel-plugin ...
I'm trying to add babel-plugin-react-css-modules to my webpack project and the style names ... in the style class names, and then the differing...
Read more >css-loader | Yarn - Package Manager
Class names will be exported as is. 'camelCase', string, Class names will be camelized, the original class name will not to be removed...
Read more >Content Types - ESBuild
Some file extensions already have a loader configured for them by default, ... However, if you're using esbuild to transform ES5 code, you...
Read more >gradle default configuration
To begin, you'll need to install css-loader: Then add the plugin to your webpack config. Using false value increase performance because we avoid...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
for css modules i use css-modules-require-hook (e.g.
ava -r css-modules-require-hook/preset
) and it works okClosing due to inactivity.