Skip to content
Merged
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
15 changes: 0 additions & 15 deletions test/e2e/nonce-head-manager/app/next.config.js

This file was deleted.

1 change: 0 additions & 1 deletion test/e2e/nonce-head-manager/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('nonce head manager', () => {
pages: new FileRef(join(__dirname, 'app/pages')),
public: new FileRef(join(__dirname, 'app/public')),
},
nextConfig: new FileRef(join(__dirname, 'app/next.config.js')),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is no longer actually testing CSP (Content Security Policy) functionality because the required next.config.js file that sets up CSP headers for the /csp route was deleted.

View Details
📝 Patch Details
diff --git a/test/e2e/nonce-head-manager/app/next.config.js b/test/e2e/nonce-head-manager/app/next.config.js
new file mode 100644
index 0000000000..0b496a7ff8
--- /dev/null
+++ b/test/e2e/nonce-head-manager/app/next.config.js
@@ -0,0 +1,15 @@
+module.exports = {
+  async headers() {
+    return [
+      {
+        source: '/csp',
+        headers: [
+          {
+            key: 'Content-Security-Policy',
+            value: "script-src-elem 'nonce-abc123' 'unsafe-eval'",
+          },
+        ],
+      },
+    ]
+  },
+}
\ No newline at end of file
diff --git a/test/e2e/nonce-head-manager/index.test.ts b/test/e2e/nonce-head-manager/index.test.ts
index a436c0aee4..e42fdbcc57 100644
--- a/test/e2e/nonce-head-manager/index.test.ts
+++ b/test/e2e/nonce-head-manager/index.test.ts
@@ -13,6 +13,7 @@ describe('nonce head manager', () => {
         pages: new FileRef(join(__dirname, 'app/pages')),
         public: new FileRef(join(__dirname, 'app/public')),
       },
+      nextConfig: new FileRef(join(__dirname, 'app/next.config.js')),
     })
   })
   afterAll(() => next.destroy())

Analysis

CSP test in nonce-head-manager no longer validates CSP functionality

What fails: The /csp route test in test/e2e/nonce-head-manager/index.test.ts no longer receives Content-Security-Policy headers, making it functionally identical to the / route test

How to reproduce:

# Missing CSP configuration in createNext() call
# Run test and check that both routes behave identically
pnpm testonly test/e2e/nonce-head-manager/index.test.ts

Result: Both test scenarios (route / and route /csp) now have identical behavior with no CSP headers, but test title claims "should not re-execute the script when re-rendering with CSP header"

Expected: The /csp route should receive CSP header script-src-elem 'nonce-abc123' 'unsafe-eval' to validate nonce-based script execution under CSP constraints per CSP script-src-elem specification

Root cause: Commit db3e559 removed both the next.config.js file and nextConfig reference from createNext() call, eliminating CSP header configuration for the test

Copy link
Member Author

@eps1lon eps1lon Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file wasn't actually used. If it were, we would expect test failures now that we removed it. nextConfig takes a partial Next.js config not a file reference.

})
})
afterAll(() => next.destroy())
Expand Down
Loading