(key: keyof AllOptions)
| 354 | }); |
| 355 | |
| 356 | function 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 | |
| 394 | describe('roots', () => { |
| 395 | testPathArray('roots'); |
no test coverage detected