rustywind icon indicating copy to clipboard operation
rustywind copied to clipboard

What is the best practice to use rustywind with jest ?

Open puneetmakkar opened this issue 3 years ago • 1 comments

Hi @praveenperera ,

Thanks for the great package.

We are using lint-staged and husky for pre-commit hooks.

rustywind changes the class order on changed files on commit and later jest test fails as snapshots have not been updated. test failure causes the rustywind changes to be reverted.

any idea on how can we resolve the issue ?

"lint-staged": {
  "*.{js,jsx,ts,tsx}": [
    "rustywind --write",
    "cross-env CI=true react-scripts test --findRelatedTests"
  ]
},
"husky": {
  "hooks": {
    "pre-commit": "lint-staged",
    "post-commit": "git update-index -g"
  }
}

Thanks.

puneetmakkar avatar Oct 01 '21 20:10 puneetmakkar

Hello @puneetmakkar,

I could be completely wrong, but if you need to generate the snapshots correctly, you need to run the command rustywind --write as well before generating them, this way the problem will be avoided 🏆

ftonato avatar Mar 23 '22 17:03 ftonato