Skip to content

Commit

Permalink
fix: fix jsOption issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 1, 2023
1 parent be8d0a2 commit e0ea1e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/loader/jsloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ export function loadConf<T>(path: string, option: LoadConfOption = {}): T {
}

export function importDefault<T>(filepath: string, content: string, option: LoadConfOption = {}): T {
return loadConf<T>(filepath);
return loadConf<T>(filepath, option);
}
11 changes: 11 additions & 0 deletions core/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,17 @@ test('Loader .autoconfrc.ts', () => {
expect(data?.projectName).toEqual('ext-ts');
});

test('Loader .autoconfrc.ts (option={ jiti: false })', () => {
const data = autoConf<{ default?: Function; projectName?: string; }>(undefined, {
cwd: path.resolve(__dirname, '../config-example/ext-ts'),
jsOption: {
jiti: false,
}
});
expect(data).toHaveProperty(['default']);
expect(data?.projectName).toBeUndefined();
});

test('Loader cwd = undefined', () => {
console.log = jest.fn();
const data = autoConf();
Expand Down

0 comments on commit e0ea1e1

Please sign in to comment.