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

Function testPathArray

packages/jest-config/src/__tests__/normalize.test.ts:356–392  ·  view source on GitHub ↗
(key: keyof AllOptions)

Source from the content-addressed store, hash-verified

354});
355
356function testPathArray(key: keyof AllOptions) {
357 it('normalizes all paths relative to rootDir', async () => {
358 const {options} = await normalize(
359 {
360 [key]: ['bar/baz', 'qux/quux/'],
361 rootDir: '/root/path/foo',
362 },
363 {} as Config.Argv,
364 );
365
366 expect(options[key]).toEqual([expectedPathFooBar, expectedPathFooQux]);
367 });
368
369 it('does not change absolute paths', async () => {
370 const {options} = await normalize(
371 {
372 [key]: ['/an/abs/path', '/another/abs/path'],
373 rootDir: '/root/path/foo',
374 },
375 {} as Config.Argv,
376 );
377
378 expect(options[key]).toEqual([expectedPathAbs, expectedPathAbsAnother]);
379 });
380
381 it('substitutes <rootDir> tokens', async () => {
382 const {options} = await normalize(
383 {
384 [key]: ['<rootDir>/bar/baz'],
385 rootDir: '/root/path/foo',
386 },
387 {} as Config.Argv,
388 );
389
390 expect(options[key]).toEqual([expectedPathFooBar]);
391 });
392}
393
394describe('roots', () => {
395 testPathArray('roots');

Callers 1

normalize.test.tsFile · 0.85

Calls 4

expectFunction · 0.85
toEqualMethod · 0.80
itFunction · 0.50
normalizeFunction · 0.50

Tested by

no test coverage detected