Skip to content

Commit

Permalink
add Runtime-statics test
Browse files Browse the repository at this point in the history
  • Loading branch information
thymikee committed Jan 7, 2019
1 parent f3e147e commit dc0650a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions packages/jest-runtime/src/__tests__/Runtime-statics.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

import HasteMap from 'jest-haste-map';
import Runtime from '../';

jest.mock('jest-haste-map');

describe('Runtime statics', () => {
const projectConfig = {
cacheDirectory: '/tmp',
haste: {},
modulePathIgnorePatterns: ['/root/ignore-1', '/root/ignore-2'],
watchPathIgnorePatterns: ['/watch-root/ignore-1'],
};
const options = {};

beforeEach(() => {
jest.clearAllMocks();
});

test('Runtime.createHasteMap passes correct ignore files to HasteMap', () => {
Runtime.createHasteMap(projectConfig, options);
expect(HasteMap).toBeCalledWith(
expect.objectContaining({
ignorePattern: /\/root\/ignore-1|\/root\/ignore-2/,
}),
);
});

test('Runtime.createHasteMap passes correct ignore files to HasteMap in watch mode', () => {
Runtime.createHasteMap(projectConfig, {...options, watch: true});
expect(HasteMap).toBeCalledWith(
expect.objectContaining({
ignorePattern: /\/root\/ignore-1|\/root\/ignore-2|\/watch-root\/ignore-1/,
watch: true,
}),
);
});
});

0 comments on commit dc0650a

Please sign in to comment.