SimenB / stylint

Improve your Stylus code with Stylint
https://simenb.github.io/stylint/
GNU General Public License v2.0
348 stars 62 forks source link

Update sortOrder message #403

Closed NikolayFrantsev closed 4 years ago

NikolayFrantsev commented 7 years ago

Hey.

Current message of sortOrder check is useless, since it's hard to understand correct properties order. I updated message with useful hint to help ordering properties.

SimenB commented 7 years ago

@Shutnik Could you add a test for this?

It's mostly to ensure I don't break it when refactoring later 😄

NikolayFrantsev commented 7 years ago

@SimenB I checked /test/test.js and seems there are no examples for testing message formats. Can you please suggest me way to write tests for current case?

SimenB commented 7 years ago

@Shutnik Easiest would be to spy on app.msg and assert it was called with the correct message.

I threw together an example in the v2 branch for you.

https://github.com/SimenB/stylint/commit/5e373b88a33279e4bf266bfd9d49ac0d124e92fa

If you wanna make the PR out to v2 instead, I would prefer that 😄 Both works, though! If you don't want to, you can spy and assert with Sinon on the master branch.

I'm currently rewriting how rules report (#356), after which tests for messages will be much cleaner.