Skip to content

Commit e2e6c9e

Browse files
committed
test(testPathPatterns): add path.relative to 'matches relative path' test
1 parent eaedf3b commit e2e6c9e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

packages/jest-pattern/src/__tests__/TestPathPatterns.test.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,21 @@ describe('TestPathPatternsExecutor', () => {
186186
});
187187

188188
it('returns true only if matches relative path', () => {
189+
const rootDir = '/home/myuser/';
190+
189191
const testPathPatterns = makeExecutor(['home'], {
190-
rootDir: '/home/myuser/',
192+
rootDir,
191193
});
192-
expect(testPathPatterns.isMatch('/home/myuser/LoginPage.js')).toBe(false);
193-
expect(testPathPatterns.isMatch('/home/myuser/HomePage.js')).toBe(true);
194+
expect(
195+
testPathPatterns.isMatch(
196+
path.relative(rootDir, '/home/myuser/LoginPage.js'),
197+
),
198+
).toBe(false);
199+
expect(
200+
testPathPatterns.isMatch(
201+
path.relative(rootDir, '/home/myuser/HomePage.js'),
202+
),
203+
).toBe(true);
194204
});
195205

196206
it('matches absolute paths regardless of rootDir', () => {

0 commit comments

Comments
 (0)