Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 584e6ba

Browse files
authored
fix: harnesses not working on Stackblitz (#1193)
Updates the test.ts to use the correct API for discovering the test files. Fixes angular/components#26806.
1 parent ad23935 commit 584e6ba

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/assets/stack-blitz/src/test.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,17 @@ import {
77
platformBrowserDynamicTesting
88
} from '@angular/platform-browser-dynamic/testing';
99

10-
declare const require: {
11-
context(path: string, deep?: boolean, filter?: RegExp): {
12-
keys(): string[];
13-
<T>(id: string): T;
14-
};
15-
};
16-
1710
// First, initialize the Angular testing environment.
1811
getTestBed().initTestEnvironment(
1912
BrowserDynamicTestingModule,
2013
platformBrowserDynamicTesting()
2114
);
2215

2316
// Then we find all the tests.
24-
const context = require.context('./', true, /\.spec\.ts$/);
17+
const context = (import.meta as any).webpackContext('./', {
18+
recursive: true,
19+
regExp: /\.spec\.ts$/
20+
});
21+
2522
// And load the modules.
2623
context.keys().map(context);

0 commit comments

Comments
 (0)