make test independent from side effects
Reviewed By: jeanlauliac Differential Revision: D4939025 fbshipit-source-id: cc7f811484cba0db4df394edef294cabe7343c8b
This commit is contained in:
parent
5bb1e4813b
commit
291a497bc4
|
@ -359,15 +359,25 @@ describe('Bundler', function() {
|
|||
]));
|
||||
});
|
||||
|
||||
it('return correct number of workers', () => {
|
||||
os.cpus.mockReturnValue({length: 1});
|
||||
expect(Bundler.getMaxWorkerCount()).toBe(1);
|
||||
os.cpus.mockReturnValue({length: 8});
|
||||
expect(Bundler.getMaxWorkerCount()).toBe(6);
|
||||
os.cpus.mockReturnValue({length: 24});
|
||||
expect(Bundler.getMaxWorkerCount()).toBe(14);
|
||||
process.env.REACT_NATIVE_MAX_WORKERS = 5;
|
||||
expect(Bundler.getMaxWorkerCount()).toBe(5);
|
||||
describe('number of workers', () => {
|
||||
beforeEach(() => {
|
||||
delete process.env.REACT_NATIVE_MAX_WORKERS;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
delete process.env.REACT_NATIVE_MAX_WORKERS;
|
||||
});
|
||||
|
||||
it('return correct number of workers', () => {
|
||||
os.cpus.mockReturnValue({length: 1});
|
||||
expect(Bundler.getMaxWorkerCount()).toBe(1);
|
||||
os.cpus.mockReturnValue({length: 8});
|
||||
expect(Bundler.getMaxWorkerCount()).toBe(6);
|
||||
os.cpus.mockReturnValue({length: 24});
|
||||
expect(Bundler.getMaxWorkerCount()).toBe(14);
|
||||
process.env.REACT_NATIVE_MAX_WORKERS = 5;
|
||||
expect(Bundler.getMaxWorkerCount()).toBe(5);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue