Fix tests + enable inline requires on react-native

Reviewed By: @sahrens, @vjeux

Differential Revision: D2456607
This commit is contained in:
Christoph Pojer 2015-09-21 13:54:06 -07:00 committed by facebook-github-bot-4
parent 6b733bdcf1
commit d088750163
4 changed files with 12 additions and 12 deletions

View File

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

View File

@ -21,13 +21,14 @@ jest
var Promise = require('promise');
var fs = require('fs');
var os = require('os');
var _ = require('underscore');
var Cache = require('../');
describe('JSTransformer Cache', () => {
var Cache;
beforeEach(() => {
require('os').tmpDir.mockImpl(() => 'tmpDir');
Cache = require('../');
os.tmpDir.mockImpl(() => 'tmpDir');
});
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() {
require('mock-modules').dumpCache();
FileWatcher = require('../');
Watcher = require('sane').WatchmanWatcher;
Watcher = 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,7 +33,6 @@ describe('Transformer', function() {
transformModulePath: '/foo/bar',
cache: new Cache({}),
};
Transformer = require('../');
});
pit('should loadFileAndTransform', function() {