Branny
Branny

Reputation: 178

jest js multiple tests in one file

I have multiple test within one file, but the output only shows one test running. If I fail any one of the test it returns a fail, but still only shows it testing one of those.

Here is what I have set up

jest.autoMockOff();
jest.dontMock('../tasks/sass_compile_imports');
var getFileList = require('../tasks/sass_compile_imports');

describe('getFileList', function(){
    var getList = getFileList.getFileList;
    var checkFileType = getFileList.checkFileType;

    it('returns array of folders', function() {
        expect(getList('../css/*.scss')).toEqual(jasmine.any(Array));
    });

    it('checks if the the correct extention is part of the file path', function() {
        expect(checkFileType('../css/*.scss')).toBeTruthy();
    });
});

The output is the following

> [email protected] test /Sites/gulp-sass-compile-imports
> jest

Using Jest CLI v0.4.0
PASS  __tests__/test2.js (0.194s)
1 test passed (1 total)
Run time: 0.383s

I'm a bit confused as to why it's not showing 2 tests. Anyone have any ideas?

Upvotes: 0

Views: 4841

Answers (1)

glortho
glortho

Reputation: 13200

Jest considers one file to be one test, targeting one module. This is different from many other test runners in terms of enumeration but is otherwise identical, running your assertions individually, etc.

Upvotes: 1

Related Questions