mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-08 21:07:46 +00:00
[cli] Convert DevServer "Unit" suite tests to "Dev" suite tests (#7845)
The `DevServer` class as it's currently implement is not really suitable for unit testing, since it calls `process.exit()` when shutting down the server. This causes Jest to exit prematurely, and prevents tests after these one from running. This was in fact hiding some failing tests. So these tests were ported over to be "Dev" suite tests which spawn a child process of `vc dev` rather than running them in-process, so that the `process.exit()` doesn't exit Jest.
This commit is contained in:
@@ -96,10 +96,16 @@ function shouldSkip(name, versions) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function validateResponseHeaders(res) {
|
||||
function validateResponseHeaders(res, podId) {
|
||||
if (res.status < 500) {
|
||||
expect(res.headers.get('server')).toEqual('Vercel');
|
||||
expect(res.headers.get('cache-control').length > 0).toBeTruthy();
|
||||
expect(res.headers.get('x-vercel-id')).toBeTruthy();
|
||||
expect(res.headers.get('cache-control').length > 0).toBeTruthy;
|
||||
if (podId) {
|
||||
expect(
|
||||
res.headers.get('x-vercel-id').includes(`::${podId}-`)
|
||||
).toBeTruthy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user