Skip to content

Commit

Permalink
fix: correct test dir (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
whxaxes authored Dec 21, 2022
1 parent 595946b commit 9094968
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const HOOK_FILE_LOADER = 'appHook:fileLoader';
export const HOOK_CONFIG_HANDLE = 'appHook:configHandle::';

export const DEFAULT_EXCLUDES = [
'test/',
'test',
'node_modules',
'.*',
'tsconfig*.json',
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/app_with_lifecycle/test/throw.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
throw new Error('should not scan me');
8 changes: 8 additions & 0 deletions test/scanner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ describe('test/scanner.test.ts', () => {
});
});

it('should not scan test dir', async () => {
const scanner = new Scanner({ needWriteFile: false, extensions: ['.ts', '.js', '.json'] });
const scanResults = await scanner.scan(path.resolve(__dirname, './fixtures/app_with_lifecycle'));
const { default: manifest } = scanResults;
expect(manifest.items).toBeDefined();
expect(manifest.items.find(item => item.filename === 'throw.ts')).toBeUndefined();
});

it('should scan module with custom loader', async () => {
// TODO: allow scan custom loader
const { default: TestCustomLoader } = await import('./fixtures/module_with_custom_loader/src/loader/test_custom_loader');
Expand Down

0 comments on commit 9094968

Please sign in to comment.