Skip to content

Commit 7f00cea

Browse files
committed
Restore testing.page_paths and testing.page_extensions configs
1 parent e9304b0 commit 7f00cea

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

config/inertia.php

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@
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.
45+
|
4246
|
4347
*/
4448

@@ -71,16 +75,33 @@
7175
| attempts to locate the component as a file relative to any of the
7276
| paths AND with any of the extensions specified here.
7377
|
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.
78+
| Note: In a future release, the `page_paths` and `page_extensions`
79+
| options below will be removed. The root-level options above
80+
| will be used for both application and testing purposes.
7781
|
7882
*/
7983

8084
'testing' => [
8185

8286
'ensure_pages_exist' => true,
8387

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

86107
'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)