heybourn / headwind

An opinionated Tailwind CSS class sorter built for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=heybourn.headwind
MIT License
1.39k stars 44 forks source link

Add testing #9

Closed praveenperera closed 4 years ago

praveenperera commented 4 years ago

Found #8 while adding this

praveenperera commented 4 years ago

Oops good catch @joshmanders, fixed

heybourn commented 4 years ago

Does this still look okay with the latest merge?

praveenperera commented 4 years ago

I rebased on master its all good still.

@heybourn do you have a preference between keeping the tests in src/, or moving them to a top level /tests folder?

Right now I've keeping them together with the files in src.

heybourn commented 4 years ago

I'm not too worried. What is best practice usually?

praveenperera commented 4 years ago

I am not either we can leave it like this for now and move it later if we need to for whatever reason.

Re: best practices I've seen it both ways, @joshmanders any input on this?

joshmanders commented 4 years ago

Depends on your preferences really. Large projects can benefit from keeping the tests with the source, so you're not pile driving through trees of directories mirroring, but for this project it might be better to have them in a top level tests/ folder.

Also I'd probably swap to using Jest over Mocha as it's more user friendly and has basically become the goto test harness for JavaScript projects.

joshmanders commented 4 years ago

Switching to Jest can be pretty easy, just drop mocha and chai from devDependencies, add jest and remove all import {expect} from 'chai' calls, as expect is already apart of Jest's global functions (like describe and it)

heybourn commented 4 years ago

@praveenperera let's roll with what Josh has said here. I like the idea of a /tests folder for now.

praveenperera commented 4 years ago

Done we now have the new scripts:

npm run test npm run test:watch npm run test:coverage

joshmanders commented 4 years ago

LGTM 👍

heybourn commented 4 years ago

File '/Users/ryan/Desktop/github/headwind/tests/utils.spec.ts' is not under 'rootDir' '/Users/ryan/Desktop/github/headwind/src'. 'rootDir' is expected to contain all source files.