mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 04:22:13 +00:00
[now-cli][now-build-utils] Update detectors (#3402)
* [now-build-utils] Consider `yarn build` and `npm run build` as `buildCommand` * [@now/build-utils] Update new detectors * Update unit tests * [@now/build-utils] Update detect-builder and detect-routes * Update tests * Run prettier * Add more tests * [now-cli] Use default detectors * Add now-dev test * Add a generic node project fallback * Fix build * Use public as default * Ensure generic node project is last * Update tests * Update tests again * Update packages/now-build-utils/src/detectors/filesystem.ts Co-Authored-By: Nathan Rajlich <n@n8.io> * Remove parentheses * Revert "Remove parentheses" This reverts commit 03f9aba07b0a6d4088719ca9afd602ce8fb1e9c1. * Use getDependencyVersion instead of hasDependency
This commit is contained in:
@@ -1114,8 +1114,7 @@ if (satisfies(process.version, '>= 8.9.0')) {
|
||||
// start `now dev` detached in child_process
|
||||
dev.unref();
|
||||
|
||||
const result = await fetchWithRetry(`http://localhost:${port}`, 80);
|
||||
const response = await result;
|
||||
const response = await fetchWithRetry(`http://localhost:${port}`, 80);
|
||||
|
||||
validateResponseHeaders(t, response);
|
||||
|
||||
@@ -1134,8 +1133,10 @@ if (satisfies(process.version, '>= 8.9.0')) {
|
||||
test(
|
||||
'[now dev] Use runtime from the functions property',
|
||||
testFixtureStdio('custom-runtime', async (t, port) => {
|
||||
const result = await fetchWithRetry(`http://localhost:${port}/api/user`, 3);
|
||||
const response = await result;
|
||||
const response = await fetchWithRetry(
|
||||
`http://localhost:${port}/api/user`,
|
||||
3
|
||||
);
|
||||
|
||||
validateResponseHeaders(t, response);
|
||||
|
||||
@@ -1143,3 +1144,20 @@ test(
|
||||
t.regex(body, /Hello, from Bash!/gm);
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[now dev] Use public with a custom Serverless Function in `server/date.js',
|
||||
testFixtureStdio('public-and-server-as-api', async (t, port) => {
|
||||
const response = await fetchWithRetry(
|
||||
`http://localhost:${port}/server/date`
|
||||
);
|
||||
|
||||
validateResponseHeaders(t, response);
|
||||
|
||||
t.is(response.status, 200);
|
||||
t.is(
|
||||
await response.text(),
|
||||
`current hour: ${Math.floor(Date.now() / 10000)}`
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user