tinyserve reads optional settings from tinyserve.json. Reading a file is one line with
[`fs/promises`](https://nodejs.org/api/fs.html#promises-api); handling what goes wrong is the
actual job.
Write async loadConfig(file), where file is an absolute path:
1. If the file does not exist (error.code === 'ENOENT'), return a copy of DEFAULTS.
2. Any other read error (e.g. EISDIR: the path is a folder) is thrown unchanged.
3. If the content is not valid JSON, throw new Error('Invalid JSON in <file name>') — only the
base name, e.g. 'Invalid JSON in tinyserve.json'. Pass the parse error as
[`cause`](https://nodejs.org/api/errors.html#errorcause).
4. If the JSON is not an object (null, an array, a number...), throw
new Error('Config must be a JSON object').
5. Otherwise return DEFAULTS overridden by the file's values, **keeping only the keys of
DEFAULTS**: unknown keys are ignored.
The test driver writes the files of each test into a temporary folder, calls your function and
reports either the result or { error: error.code ?? error.message }.
{ "port": 8080, "color": "blue" }→ { port: 8080, root: 'public', gzip: false }
Sample tests