Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Dec 28, 2024
1 parent c286755 commit f0c3577
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 22 deletions.
2 changes: 1 addition & 1 deletion test/egg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('test/egg.test.ts', () => {
new EggCore({
baseDir: getFilepath('egg/index.js'),
});
}, /not a directory/);
}, /not a directory|no such file or directory/);
});

it('should throw process.env.EGG_READY_TIMEOUT_ENV should be able to parseInt', () => {
Expand Down
6 changes: 5 additions & 1 deletion test/loader/get_framework_paths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ describe('test/loader/get_framework_paths.test.ts', () => {

it('should get from parameter', () => {
app = createApp('eggpath');
assert.deepEqual(app.loader.eggPaths, [ getFilepath('egg-esm') ]);
let eggPaths = app.loader.eggPaths;
if (process.platform === 'win32') {
eggPaths = eggPaths.map(filepath => filepath.toLowerCase());
}
assert.deepEqual(eggPaths, [ getFilepath('egg-esm') ]);
});

it('should get from framework using symbol', async () => {
Expand Down
12 changes: 10 additions & 2 deletions test/loader/get_load_units.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,17 @@ describe('test/loader/get_load_units.test.ts', () => {
const units = app.loader.getLoadUnits();
assert.equal(units.length, 12);
assert.equal(units[10].type, 'framework');
assert.equal(units[10].path, getFilepath('egg-esm'));
if (process.platform === 'win32') {
assert.equal(units[10].path, getFilepath('egg-esm').toLowerCase());
} else {
assert.equal(units[10].path, getFilepath('egg-esm'));
}
assert.equal(units[11].type, 'app');
assert.equal(units[11].path, getFilepath('plugin'));
if (process.platform === 'win32') {
assert.equal(units[11].path, getFilepath('plugin').toLowerCase());
} else {
assert.equal(units[11].path, getFilepath('plugin'));
}
});

it('should not get plugin dir', () => {
Expand Down
55 changes: 37 additions & 18 deletions test/loader/mixin/load_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,43 @@ describe('test/loader/mixin/load_config.test.ts', () => {
await app.loader.loadConfig();
const configMeta = app.loader.configMeta;
const configPath = getFilepath('configmeta/config/config.js');
assert.equal(configMeta.console, configPath);
assert.equal(configMeta.array, configPath);
assert.equal(configMeta.buffer, configPath);
assert.equal(configMeta.ok, configPath);
assert.equal(configMeta.f, configPath);
assert.equal(configMeta.empty, configPath);
assert.equal(configMeta.zero, configPath);
assert.equal(configMeta.number, configPath);
assert.equal(configMeta.no, configPath);
assert.equal(configMeta.date, configPath);
assert.equal(configMeta.ooooo, configPath);

assert.equal(configMeta.urllib.keepAlive, configPath);
assert.equal(configMeta.urllib.timeout, getFilepath('egg-esm/config/config.default.js'));
assert.equal(configMeta.urllib.foo, configPath);
assert.equal(configMeta.urllib.n, configPath);
assert.equal(configMeta.urllib.dd, configPath);
assert.equal(configMeta.urllib.httpclient, configPath);
if (process.platform === 'win32') {
assert.equal(configMeta.console.toLowerCase(), configPath);
assert.equal(configMeta.array.toLowerCase(), configPath);
assert.equal(configMeta.buffer.toLowerCase(), configPath);
assert.equal(configMeta.ok.toLowerCase(), configPath);
assert.equal(configMeta.f.toLowerCase(), configPath);
assert.equal(configMeta.empty.toLowerCase(), configPath);
assert.equal(configMeta.zero.toLowerCase(), configPath);
assert.equal(configMeta.number.toLowerCase(), configPath);
assert.equal(configMeta.no.toLowerCase(), configPath);
assert.equal(configMeta.date.toLowerCase(), configPath);
assert.equal(configMeta.ooooo.toLowerCase(), configPath);
assert.equal(configMeta.urllib.keepAlive.toLowerCase(), configPath);
assert.equal(configMeta.urllib.timeout.toLowerCase(), getFilepath('egg-esm/config/config.default.js'));
assert.equal(configMeta.urllib.foo.toLowerCase(), configPath);
assert.equal(configMeta.urllib.n.toLowerCase(), configPath);
assert.equal(configMeta.urllib.dd.toLowerCase(), configPath);
assert.equal(configMeta.urllib.httpclient.toLowerCase(), configPath);
} else {
assert.equal(configMeta.console, configPath);
assert.equal(configMeta.array, configPath);
assert.equal(configMeta.buffer, configPath);
assert.equal(configMeta.ok, configPath);
assert.equal(configMeta.f, configPath);
assert.equal(configMeta.empty, configPath);
assert.equal(configMeta.zero, configPath);
assert.equal(configMeta.number, configPath);
assert.equal(configMeta.no, configPath);
assert.equal(configMeta.date, configPath);
assert.equal(configMeta.ooooo, configPath);
assert.equal(configMeta.urllib.keepAlive, configPath);
assert.equal(configMeta.urllib.timeout, getFilepath('egg-esm/config/config.default.js'));
assert.equal(configMeta.urllib.foo, configPath);
assert.equal(configMeta.urllib.n, configPath);
assert.equal(configMeta.urllib.dd, configPath);
assert.equal(configMeta.urllib.httpclient, configPath);
}
// undefined will be ignore
assert.equal(configMeta.urllib.bar, undefined);
});
Expand Down

0 comments on commit f0c3577

Please sign in to comment.