forked from remix-run/remix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
readConfig-test.ts
65 lines (60 loc) · 2.01 KB
/
readConfig-test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import path from "path";
import type { RemixConfig } from "../config";
import { readConfig } from "../config";
const remixRoot = path.resolve(__dirname, "./fixtures/stack");
describe("readConfig", () => {
let config: RemixConfig;
beforeEach(async () => {
config = await readConfig(remixRoot);
});
it("generates a config", async () => {
expect(config).toMatchInlineSnapshot(
{
rootDirectory: expect.any(String),
appDirectory: expect.any(String),
cacheDirectory: expect.any(String),
devServerPort: expect.any(Number),
serverBuildPath: expect.any(String),
assetsBuildDirectory: expect.any(String),
relativeAssetsBuildDirectory: expect.any(String),
tsconfigPath: expect.any(String)
},
`
Object {
"appDirectory": Any<String>,
"assetsBuildDirectory": Any<String>,
"cacheDirectory": Any<String>,
"devServerBroadcastDelay": 0,
"devServerPort": Any<Number>,
"entryClientFile": "entry.client.tsx",
"entryServerFile": "entry.server.tsx",
"mdx": undefined,
"publicPath": "/build/",
"relativeAssetsBuildDirectory": Any<String>,
"rootDirectory": Any<String>,
"routes": Object {
"root": Object {
"file": "root.tsx",
"id": "root",
"path": "",
},
},
"serverBuildPath": Any<String>,
"serverBuildTarget": undefined,
"serverBuildTargetEntryModule": "export * from \\"@remix-run/dev/server-build\\";",
"serverDependenciesToBundle": Array [],
"serverEntryPoint": undefined,
"serverMode": "production",
"serverModuleFormat": "cjs",
"serverPlatform": "node",
"tsconfigPath": Any<String>,
"watchPaths": Array [],
}
`
);
});
it("returns the same devServerPort value across reloads", async () => {
let newConfig = await readConfig(remixRoot);
expect(newConfig.devServerPort).toBe(config.devServerPort);
});
});