-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
index.js
59 lines (51 loc) · 1.38 KB
/
index.js
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
import { join } from 'path';
import { test } from 'uvu';
import * as assert from 'uvu/assert';
import { fileURLToPath } from 'url';
import { load_config } from '../index.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = join(__filename, '..');
/**
* @param {string} path
*/
async function testLoadDefaultConfig(path) {
const cwd = join(__dirname, 'fixtures', path);
const config = await load_config({ cwd });
delete config.kit.vite; // can't test equality of a function
assert.equal(config, {
compilerOptions: null,
extensions: ['.svelte'],
kit: {
adapter: null,
amp: false,
appDir: '_app',
files: {
assets: join(cwd, 'static'),
hooks: join(cwd, 'src/hooks'),
lib: join(cwd, 'src/lib'),
routes: join(cwd, 'src/routes'),
serviceWorker: join(cwd, 'src/service-worker'),
setup: join(cwd, 'src/setup'),
template: join(cwd, 'src/app.html')
},
floc: false,
host: null,
hostHeader: null,
hydrate: true,
paths: { base: '', assets: '/.' },
prerender: { crawl: true, enabled: true, force: false, pages: ['*'] },
router: true,
ssr: true,
target: null,
trailingSlash: 'never'
},
preprocess: null
});
}
test('load default config (cjs)', async () => {
await testLoadDefaultConfig('default-cjs');
});
test('load default config (esm)', async () => {
await testLoadDefaultConfig('default-esm');
});
test.run();