-
Notifications
You must be signed in to change notification settings - Fork 27
WIP: Test tweaks #55
base: master
Are you sure you want to change the base?
WIP: Test tweaks #55
Conversation
@nfantone Would you agree with having one test file per file in lib with a |
@nickmccurdy I'd say normally, in backend projects, tests are kept separate in their own directory. We could, however, mirror the |
I know that's typical, Jest supports both conventions. The nice thing about |
My vote is on keeping them under The again, I'm not completely against to the idea of having sources and tests together if that that we decide to follow. |
Besides |
@nickmccurdy On a related note, I'm also not too fond of moving configuration to
But again, this is just my opinion 🐐 |
I don't think conflicts would be an issue since eslint has its own section, the conflicts would likely be above the eslint config and still happen either way. I believe npm supports adding arbitrary fields with no issues, either way because the dependencies that use those fields are installed with the same versions in the package lock, it should be fine. Also it seems like more an more packages are moving config to I'm still open to suggestions about everything, I'm mostly experimenting with stuff. Also I'll try to make small commits so if we disagree on something later we can revert it |
lib/conditional-get.test.js
Outdated
.get('/') | ||
.expect(200, (err, res) => { | ||
if (err) return done(err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still log errors without the done(err)
? Or are they swallowed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because if supertest throws an error the promise will reject, and since it's returned to Jest it will be automatically handled and the test will error. One of the nice things about promises is you only have to set up a handler once per chain, and for things like Jest it's handled automatically.
lib/jsonp.test.js
Outdated
.get('/user.json') | ||
.expect(200) | ||
.expect({'foo': 'bar'}, done); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooo this was a tricky bit of hackery. Glad we don't need it anymore.
Whoops looks like I broke coverage on the listen function, I'll write a small test for it and wrap this up reorganizing the test files soon. |
I fixed the directory structure, I'll ask for another review after I add the missing |
Mostly just adjusting syntax and tooling based on some ideas I had in #52 and #53.
.test.js
extensionspackage.json
onlypackage.json
validate
totest
so Travis runs the same command as local development__tests__
directory per source directory instead