mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-07 21:07:46 +00:00
[now-next] Implement new handles for custom routes (#3892)
This implements the new handles from https://github.com/zeit/now/pull/3876 to allow us to ensure the proper order for `rewrites`, `redirects`, and `headers` in Next.js. I also added in the tests from the Next.js [custom-routes test suite](https://github.com/zeit/next.js/tree/canary/test/integration/custom-routes) to ensure we're matching behavior. To help keep track of what each probe is testing I added support for parsing the `now.json` files in `testDeployment` as [JSON5](https://www.npmjs.com/package/json5) to allow adding comments before each probe. If this is undesired I can remove this specific change even though it makes managing the fixture tests much easier
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const assert = require('assert');
|
||||
const bufferReplace = require('buffer-replace');
|
||||
const fs = require('fs');
|
||||
const json5 = require('json5');
|
||||
const glob = require('util').promisify(require('glob'));
|
||||
const path = require('path');
|
||||
const { spawn } = require('child_process');
|
||||
@@ -52,7 +53,8 @@ async function testDeployment(
|
||||
);
|
||||
}
|
||||
|
||||
const nowJson = JSON.parse(bodies['now.json']);
|
||||
// we use json5 to allow comments for probes
|
||||
const nowJson = json5.parse(bodies['now.json']);
|
||||
|
||||
if (process.env.NOW_BUILDER_DEBUG) {
|
||||
if (!nowJson.build) {
|
||||
|
||||
Reference in New Issue
Block a user