Skip to content

Commit

Permalink
[tests] fix brittle next rewrite probe test (#10934)
Browse files Browse the repository at this point in the history
It seems the intention of this test was to verify that the rewritten
file matches the original file, but it does so by just asserting on
arbitrary script text, which is brittle and broke as a result of
vercel/next.js#56294

The right way to test this would be to fetch the original script and
compare the contents with the rewritten script, but this relies on
`__NEXT_SCRIPT__` magic which is only available in probe checks. For now
this just asserts on a valid status code, as a chunk that isn't properly
rewritten should 404 in this case.
  • Loading branch information
ztanner authored Dec 12, 2023
1 parent 7582571 commit ab34a26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .changeset/twelve-pots-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
// should match /_next file after rewrite
{
"path": "/hidden/_next/__NEXT_SCRIPT__(/hello)",
"mustContain": "createElement"
"status": 200
},
// should allow redirecting to external resource
{
Expand Down

0 comments on commit ab34a26

Please sign in to comment.