Closed praveenperera closed 4 years ago
Oops good catch @joshmanders, fixed
Does this still look okay with the latest merge?
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
.
I'm not too worried. What is best practice usually?
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?
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.
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
)
@praveenperera let's roll with what Josh has said here. I like the idea of a /tests folder for now.
Done we now have the new scripts:
npm run test
npm run test:watch
npm run test:coverage
LGTM 👍
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.
Found #8 while adding this