diff --git a/tests/unit/Deployment/FrameworksTest.php b/tests/unit/Deployment/FrameworksTest.php new file mode 100644 index 0000000000..26b0a2fba2 --- /dev/null +++ b/tests/unit/Deployment/FrameworksTest.php @@ -0,0 +1,40 @@ +frameworks = require('app/config/frameworks.php'); + } + + public function testStaticOutputStaysInsideSsrOutput(): void + { + foreach ($this->frameworks as $key => $framework) { + // Next.js exports a static site to its own root rather than into the ssr build. + if ($key === 'nextjs') { + continue; + } + + $ssr = $framework['adapters']['ssr']['outputDirectory'] ?? null; + $static = $framework['adapters']['static']['outputDirectory'] ?? null; + + if ($ssr === null || $static === null) { + continue; + } + + $this->assertStringStartsWith( + \rtrim($ssr, '/') . '/', + \rtrim($static, '/') . '/', + "Framework '{$key}' serves static files from outside its ssr build output." + ); + } + } +}