Skip to content

Commit 5a67328

Browse files
committed
refactor: fix int test
1 parent a5319d8 commit 5a67328

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/core/src/lib/implementation/read-rc-file.int.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ describe('readRcByPath', () => {
5555
});
5656

5757
it('should throw if the path is empty', async () => {
58-
await expect(readRcByPath('')).rejects.toThrow("File '' does not exist");
58+
await expect(readRcByPath('')).rejects.toThrow(
59+
"Importing module failed. File '' does not exist",
60+
);
5961
});
6062

6163
it('should throw if the file does not exist', async () => {

packages/utils/src/lib/import-module.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ export async function importModule<T = unknown>(
1818
): Promise<T> {
1919
const { filepath, tsconfig, ...jitiOptions } = options;
2020

21+
if (!filepath) {
22+
throw new Error(
23+
`Importing module failed. File '${filepath}' does not exist`,
24+
);
25+
}
26+
2127
const absoluteFilePath = path.resolve(process.cwd(), filepath);
2228
const resolvedStats = await settlePromise(stat(absoluteFilePath));
2329
if (resolvedStats.status === 'rejected') {

0 commit comments

Comments
 (0)