Skip to content

Commit 49521d3

Browse files
authored
Merge pull request #756 from inertiajs/restore-testing-config-keys
[2.x] Restore `testing.page_paths` and `testing.page_extensions` configs
2 parents e9304b0 + d4909a6 commit 49521d3

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

config/inertia.php

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@
3636
| Pages
3737
|--------------------------------------------------------------------------
3838
|
39-
| If you want to ensure that the pages exist, you can set `ensure_pages_exist` to true.
40-
| This will throw an exception if the component does not exist on the filesystem
41-
| when rendering a page. You may configure this separately for testing.
39+
| Set `ensure_pages_exist` to true if you want to enforce that Inertia page
40+
| components exist on disk when rendering a page. This is useful for
41+
| catching missing or misnamed components.
42+
|
43+
| The `page_paths` and `page_extensions` options define where to look
44+
| for page components and which file extensions to consider.
4245
|
4346
*/
4447

@@ -71,16 +74,33 @@
7174
| attempts to locate the component as a file relative to any of the
7275
| paths AND with any of the extensions specified here.
7376
|
74-
| By default, it uses the `page_paths` and `page_extensions` settings
75-
| defined above. You may override these values for testing purposes
76-
| by adding these two keys to this `testing` array.
77+
| Note: In a future release, the `page_paths` and `page_extensions`
78+
| options below will be removed. The root-level options above
79+
| will be used for both application and testing purposes.
7780
|
7881
*/
7982

8083
'testing' => [
8184

8285
'ensure_pages_exist' => true,
8386

87+
'page_paths' => [
88+
89+
resource_path('js/Pages'),
90+
91+
],
92+
93+
'page_extensions' => [
94+
95+
'js',
96+
'jsx',
97+
'svelte',
98+
'ts',
99+
'tsx',
100+
'vue',
101+
102+
],
103+
84104
],
85105

86106
'history' => [

src/ServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public function register(): void
4343
$this->app->bind('inertia.testing.view-finder', function ($app) {
4444
return new FileViewFinder(
4545
$app['files'],
46-
$app['config']->get('inertia.testing.page_paths', fn () => $app['config']->get('inertia.page_paths')),
47-
$app['config']->get('inertia.testing.page_extensions', fn () => $app['config']->get('inertia.page_extensions'))
46+
$app['config']->get('inertia.testing.page_paths'),
47+
$app['config']->get('inertia.testing.page_extensions')
4848
);
4949
});
5050
}

0 commit comments

Comments
 (0)