Skip to content

Commit

Permalink
allows for __tests__ & __test__ directories (#4438)
Browse files Browse the repository at this point in the history
* fixes #4435 allows for __tests__ directories

* tests hard-coded __tests__

* runs changeset

* Better release notes

* allows `__test__` in addition to `__tests__`
  • Loading branch information
Christopher McCulloh authored Mar 31, 2022
1 parent 8884538 commit a11bae8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/modern-cameras-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

allow files and directories named `__tests__` and `__test__` in the routes directory
2 changes: 1 addition & 1 deletion packages/kit/src/core/sync/create_manifest_data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { parse_route_id } from '../../../utils/routing.js';
* }} Item
*/

const specials = new Set(['__layout', '__layout.reset', '__error']);
const specials = new Set(['__layout', '__layout.reset', '__error', '__tests__', '__test__']);

/**
* @param {{
Expand Down
6 changes: 6 additions & 0 deletions packages/kit/src/core/sync/create_manifest_data/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,12 @@ test('errors on encountering an illegal __file', () => {
);
});

test('allows for __tests__ directories', () => {
const { routes } = create('samples/legal-dunder');

assert.equal(routes, []);
});

test('creates param matchers', () => {
const { matchers } = create('samples/basic'); // directory doesn't matter for the test

Expand Down

0 comments on commit a11bae8

Please sign in to comment.