MCPcopy
hub / github.com/jestjs/jest / initSearchSource

Function initSearchSource

packages/jest-core/src/__tests__/SearchSource.test.ts:44–61  ·  view source on GitHub ↗
(
  initialOptions: Config.InitialOptions,
  options: {
    contextFiles?: Array<string>;
  } = {},
)

Source from the content-addressed store, hash-verified

42const toPaths = (tests: Array<Test>) => tests.map(({path}) => path);
43
44const initSearchSource = async (
45 initialOptions: Config.InitialOptions,
46 options: {
47 contextFiles?: Array<string>;
48 } = {},
49) => {
50 const {options: config} = await normalize(initialOptions, {} as Config.Argv);
51 const context = await Runtime.createContext(config, {
52 maxWorkers,
53 watchman: false,
54 });
55 if (options.contextFiles) {
56 jest
57 .spyOn(context.hasteFS, 'getAllFiles')
58 .mockReturnValue(options.contextFiles);
59 }
60 return {config, searchSource: new SearchSource(context)};
61};
62
63describe('SearchSource', () => {
64 const id = 'SearchSource';

Callers 2

getTestPathsFunction · 0.85

Calls 4

normalizeFunction · 0.90
createContextMethod · 0.80
mockReturnValueMethod · 0.80
spyOnMethod · 0.80

Tested by

no test coverage detected