kentcdodds / jest-glamor-react

Jest utilities for Glamor and React
https://npm.im/jest-glamor-react
MIT License
98 stars 24 forks source link

EDIT: Solved, user error. --- No styles output in snapshot #4

Closed ThomasBrekelmans closed 7 years ago

ThomasBrekelmans commented 7 years ago

EDIT: After creating a new example project from scratch, this library works as expected. Sorry for the confusion, please delete/close this issue.

I've used the following package.json to get everything up and running:

{
  "name": "jest-glamor-react-example",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "jest"
  },
  "author": "",
  "license": "UNLICENSED",
  "devDependencies": {
    "babel-jest": "^20.0.0",
    "babel-preset-env": "^1.4.0",
    "babel-preset-react": "^6.24.1",
    "glamor": "^2.20.25",
    "jest": "^20.0.0",
    "jest-glamor-react": "^1.3.0",
    "react": "^15.5.4",
    "react-dom": "^15.5.4",
    "react-test-renderer": "^15.5.4"
  }
}

With the following .babelrc file:

{
    "presets": [
        ["env", {
            "targets": {
                "node": 7
            }
        }],
        "react"
    ]
}

I then added a file in test/Example.test.js with the contents of the example in the README.md.

Then running npm t creates the snapshot with the style rules in them as expected.

Again, thanks for this!

kentcdodds commented 7 years ago

Glad you got it working!