Hello!
I'm new to using Jest, and wanted to see if we're using it correctly so far.
We have this test file with one function under test, and two scenarios:
In case that link changes, here's the code:
describe('gitHubEventsToApiResponse', () => {
describe('when 0 events present', () => {
it('returns an empty array', () => {
expect(gitHubEventsToApiResponse([])).toEqual({
commits: []
});
});
});
describe('when 1 event present', () => {
let events = eventsData.Single;
let actual = gitHubEventsToApiResponse(events);
it('returns a 1 mapped event', () => {
expect(actual.commits.length).toEqual(1);
});
});
});
We run this first through traceur like this to convert from es6 to es5 (Didn't have luck with the native approach for Jest)
#!/usr/bin/sh
export PATH=$(pwd)/node_modules/.bin:$PATH
# Compile
code from ES6 to ES5 before test
find . -name '__tests__' ! -path
'./node_modules/*' | xargs rm -rf
find . -name '__tests' ! -path
'./node_modules/*' -exec sh -c 'mkdir -p $1__ && traceur --modules
commonjs --dir $1 $1__/ ' - {} \;
npm test
That's all fine so far, but when we see the output we get:
> openAgile.C...@0.0.1 test c:\Projects\github\CommitStream.Web\src\app
> jest
Found 1 matching test...
PASS api\translators\__tests__\gitHubEventsToApiResponse-test.js (0.071s)
1 test passed (1 total)
Run time: 3.027s
We were hoping it said, at least, 2 tests since we have 2 nested describe, or perhaps because of 2 it calls. Of course, it's all debatable how it should look.
But, I'm just curious is this something that's configurable or desirable if we wanted to contribute a pull-request?