Enable Jest tests

Reviewed By: @amasad

Differential Revision: D2422290
This commit is contained in:
Pieter De Baets 2015-09-20 16:46:36 -07:00 committed by facebook-github-bot-7
parent ddd6fe3fae
commit d94ed42e1c
4 changed files with 12 additions and 11 deletions

View File

@ -68,7 +68,7 @@ describe('Activity', () => {
expect(() => {
Activity.endEvent(eid);
}).toThrow('event(1) has already ended!');
}).toThrow('event(3) has already ended!');
});
});
@ -80,8 +80,8 @@ describe('Activity', () => {
Activity.signal(EVENT_NAME, DATA);
jest.runOnlyPendingTimers();
expect(console.log.mock.calls.length).toBe(1);
const consoleMsg = console.log.mock.calls[0][0];
expect(console.log.mock.calls.length).toBe(3);
const consoleMsg = console.log.mock.calls[2][0];
expect(consoleMsg).toContain(EVENT_NAME);
expect(consoleMsg).toContain(JSON.stringify(DATA));
});

View File

@ -20,14 +20,14 @@ jest
.mock('fs');
var Promise = require('promise');
var Cache = require('../');
var fs = require('fs');
var os = require('os');
var _ = require('underscore');
describe('JSTransformer Cache', () => {
var Cache;
beforeEach(() => {
os.tmpDir.mockImpl(() => 'tmpDir');
require('os').tmpDir.mockImpl(() => 'tmpDir');
Cache = require('../');
});
describe('getting/setting', () => {

View File

@ -19,14 +19,14 @@ jest
}
});
var FileWatcher = require('../');
var sane = require('sane');
describe('FileWatcher', function() {
var FileWatcher;
var Watcher;
beforeEach(function() {
Watcher = sane.WatchmanWatcher;
require('mock-modules').dumpCache();
FileWatcher = require('../');
Watcher = require('sane').WatchmanWatcher;
Watcher.prototype.once.mockImplementation(function(type, callback) {
callback();
});

View File

@ -15,12 +15,12 @@ jest
jest.mock('fs');
var Cache = require('../../Cache');
var Transformer = require('../');
var fs = require('fs');
var options;
describe('Transformer', function() {
var Transformer;
var workers;
beforeEach(function() {
@ -33,6 +33,7 @@ describe('Transformer', function() {
transformModulePath: '/foo/bar',
cache: new Cache({}),
};
Transformer = require('../');
});
pit('should loadFileAndTransform', function() {