Make plugins/reporting config snapshot deterministic (#38019) (#38033)

This commit is contained in:
Chandler Prall 2019-06-05 10:57:15 -04:00 committed by GitHub
parent a9449a4d9a
commit 3a23648223
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,18 @@
import { reporting } from './index';
import { getConfigSchema } from '../../test_utils';
// The snapshot records the number of cpus available
// to make the snapshot deterministic `os.cpus` needs to be mocked
// but the other members on `os` must remain untouched
jest.mock(
'os',
() => {
const os = jest.requireActual('os');
os.cpus = () => [{}, {}, {}, {}];
return os;
}
);
const describeWithContext = describe.each([
[{ dev: false, dist: false }],
[{ dev: true, dist: false }],