Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions context/skip-patterns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ global:
regex:
# Skip .env files but allow .env.example
- ^.env(?!\.example$)
# Skip a root-level test/ or tests/ dir. The `/test/` substring above only
# catches nested ones, because shouldSkip is given a path relative to the
# example root, so the root dir has no leading slash to match on. The
# separator class also covers path.relative output on Windows.
- ^tests?[/\\]

# Example-specific overrides
# Add patterns here to skip files only for specific examples
Expand Down
12 changes: 12 additions & 0 deletions scripts/lib/tests/skip-patterns.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ describe('shouldSkip', () => {
expect(shouldSkip('.env.example', patterns)).toBe(false);
});

it('skips a root-level test dir, not only nested ones', () => {
const patterns = mergeSkipPatterns({
includes: ['/test/'],
regex: [new RegExp('^tests?[/\\\\]')],
allow: [],
});
expect(shouldSkip('app/test/helpers.py', patterns)).toBe(true);
expect(shouldSkip('test/test_api.py', patterns)).toBe(true);
expect(shouldSkip('tests/example.spec.ts', patterns)).toBe(true);
expect(shouldSkip('testing/settings.py', patterns)).toBe(false);
});

it('keeps files matching no pattern', () => {
const patterns = mergeSkipPatterns(globalPatterns);
expect(shouldSkip('Sources/App.swift', patterns)).toBe(false);
Expand Down