Skip to content

Commit 5084ba8

Browse files
committed
test: use esbuild-based karma builder for e2e tests in esbuild suite
Updated the E2E tests to use the esbuild-based karma builder when running the esbuild test suite.
1 parent 09f5006 commit 5084ba8

File tree

3 files changed

+18
-33
lines changed

3 files changed

+18
-33
lines changed

tests/legacy-cli/e2e/tests/misc/karma-error-paths.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1+
import assert from 'node:assert';
2+
import { getGlobalVariable } from '../../utils/env';
13
import { writeFile } from '../../utils/fs';
24
import { ng } from '../../utils/process';
5+
import { assertIsError } from '../../utils/utils';
36

47
export default async function () {
8+
if (getGlobalVariable('argv')['esbuild']) {
9+
// TODO: enable once this is fixed when using the esbuild builder.
10+
return;
11+
}
12+
513
await writeFile(
614
'src/app/app.component.spec.ts',
715
`
8-
it('show fail', () => {
16+
it('should fail', () => {
917
expect(undefined).toBeTruthy();
1018
});
1119
`,
@@ -16,18 +24,18 @@ export default async function () {
1624
await ng('test', '--no-watch', '--source-map');
1725
throw new Error('ng test should have failed.');
1826
} catch (error) {
19-
if (!(error instanceof Error && error.message.includes('app.component.spec.ts'))) {
20-
throw error;
21-
}
27+
assertIsError(error);
28+
assert.match(error.message, /src\/app\/app\.component\.spec\.ts/);
29+
assert.doesNotMatch(error.message, /_karma_webpack_/);
2230
}
2331

2432
// when sourcemaps are 'off' the stacktrace won't point to the spec.ts file.
2533
try {
2634
await ng('test', '--no-watch', '--no-source-map');
2735
throw new Error('ng test should have failed.');
2836
} catch (error) {
29-
if (!(error instanceof Error && error.message.includes('main.js'))) {
30-
throw error;
31-
}
37+
assertIsError(error);
38+
assert.match(error.message, /main\.js/);
39+
assert.doesNotMatch(error.message, /_karma_webpack_/);
3240
}
3341
}

tests/legacy-cli/e2e/utils/project.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ export async function useCIChrome(projectName: string, projectDir = ''): Promise
192192
const project = workspaceJson.projects[projectName];
193193
const appTargets = project.targets || project.architect;
194194
appTargets.test.options.browsers = 'ChromeHeadlessNoSandbox';
195+
appTargets.test.options.builderMode = getGlobalVariable('argv')['esbuild']
196+
? 'application'
197+
: 'browser';
195198
});
196199
}
197200

0 commit comments

Comments
 (0)