Skip to content

Stablize CI tests #30669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ module.exports = function(config) {
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
Expand Down
3 changes: 2 additions & 1 deletion modules/testing/builder/src/builder-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class BuilderHarness<T> {
}

const logs: logging.LogEntry[] = [];
context.logger.subscribe((e) => logs.push(e));
const logger$ = context.logger.subscribe((e) => logs.push(e));

return observableFrom(this.schemaRegistry.compile(this.builderInfo.optionSchema)).pipe(
mergeMap((validator) => validator(targetOptions)),
Expand Down Expand Up @@ -302,6 +302,7 @@ export class BuilderHarness<T> {
}),
finalize(() => {
this.watcherNotifier = undefined;
logger$.unsubscribe();

for (const teardown of context.teardowns) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Expand Down
4 changes: 2 additions & 2 deletions modules/testing/builder/src/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import {
import path from 'node:path';
import { firstValueFrom } from 'rxjs';

// Default timeout for large specs is 2.5 minutes.
jasmine.DEFAULT_TIMEOUT_INTERVAL = 150000;
// Default timeout for large specs is 60s.
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60_000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ Always great to see these decrease!


export const workspaceRoot = join(normalize(__dirname), `../projects/hello-world-app/`);
export const host = new TestProjectHost(workspaceRoot);
Expand Down
12 changes: 6 additions & 6 deletions packages/angular/build/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,23 @@ ts_project(

jasmine_test(
name = "application_integration_tests",
size = "large",
size = "medium",
data = [":application_integration_test_lib"],
flaky = True,
shard_count = 20,
shard_count = 25,
)

jasmine_test(
name = "dev-server_integration_tests",
size = "large",
size = "medium",
data = [":dev-server_integration_test_lib"],
flaky = True,
shard_count = 10,
)

jasmine_test(
name = "karma_integration_tests",
size = "large",
size = "medium",
data = [":karma_integration_test_lib"],
env = {
# TODO: Replace Puppeteer downloaded browsers with Bazel-managed browsers,
Expand All @@ -320,9 +320,9 @@ jasmine_test(

jasmine_test(
name = "unit-test_integration_tests",
size = "large",
size = "small",
data = [":unit-test_integration_test_lib"],
shard_count = 10,
shard_count = 5,
)

genrule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ import { buildApplication } from '../../index';
import { APPLICATION_BUILDER_INFO, BASE_OPTIONS, describeBuilder } from '../setup';

describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
beforeEach(async () => {
// Add a global stylesheet media file
await harness.writeFile('src/styles.css', `h1 { background: url('./spectrum.png')}`);
// Add a component stylesheet media file
await harness.writeFile('src/app/abc.svg', '');
await harness.writeFile('src/app/app.component.css', `h2 { background: url('./abc.svg')}`);

// Enable SSR
await harness.modifyFile('src/tsconfig.app.json', (content) => {
const tsConfig = JSON.parse(content);
tsConfig.files ??= [];
tsConfig.files.push('main.server.ts', 'server.ts');
describe('Option: "outputPath"', () => {
beforeEach(async () => {
// Add a global stylesheet media file
await harness.writeFile('src/styles.css', `h1 { background: url('./spectrum.png')}`);
// Add a component stylesheet media file
await harness.writeFile('src/app/abc.svg', '');
await harness.writeFile('src/app/app.component.css', `h2 { background: url('./abc.svg')}`);

// Enable SSR
await harness.modifyFile('src/tsconfig.app.json', (content) => {
const tsConfig = JSON.parse(content);
tsConfig.files ??= [];
tsConfig.files.push('main.server.ts', 'server.ts');

return JSON.stringify(tsConfig);
});

return JSON.stringify(tsConfig);
// Application server code is not needed in this test
await harness.writeFile('src/main.server.ts', `console.log('Hello!');`);
await harness.writeFile('src/server.ts', `console.log('Hello!');`);
});

// Application server code is not needed in this test
await harness.writeFile('src/main.server.ts', `console.log('Hello!');`);
await harness.writeFile('src/server.ts', `console.log('Hello!');`);
});

describe('Option: "outputPath"', () => {
describe(`when option value is is a string`, () => {
beforeEach(() => {
describe('when option value is a string', () => {
it('should emit browser, media and server files in their respective directories', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
polyfills: [],
Expand All @@ -44,34 +44,20 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
entry: 'src/server.ts',
},
});
});

it(`should emit browser bundles in 'browser' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/browser/main.js').toExist();
});

it(`should emit media files in 'browser/media' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/browser/media/spectrum.png').toExist();
harness.expectFile('dist/browser/media/abc.svg').toExist();
});

it(`should emit server bundles in 'server' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/server/server.mjs').toExist();
});
});

describe(`when option value is an object`, () => {
describe('when option value is an object', () => {
describe(`'media' is set to 'resources'`, () => {
beforeEach(() => {
it('should emit browser, media and server files in their respective directories', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
polyfills: [],
Expand All @@ -85,33 +71,19 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
entry: 'src/server.ts',
},
});
});

it(`should emit browser bundles in 'browser' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/browser/main.js').toExist();
});

it(`should emit media files in 'browser/resource' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/browser/resource/spectrum.png').toExist();
harness.expectFile('dist/browser/resource/abc.svg').toExist();
});

it(`should emit server bundles in 'server' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/server/server.mjs').toExist();
});
});

describe(`'media' is set to ''`, () => {
beforeEach(() => {
it('should emit browser, media and server files in their respective directories', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
polyfills: [],
Expand All @@ -125,36 +97,20 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
entry: 'src/server.ts',
},
});
});

it(`should emit browser bundles in 'browser' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/browser/main.js').toExist();
});

it(`should emit media files in 'browser' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/browser/spectrum.png').toExist();
harness.expectFile('dist/browser/abc.svg').toExist();

// Component CSS should not be considered media
harness.expectFile('dist/browser/app.component.css').toNotExist();
});

it(`should emit server bundles in 'server' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/server/server.mjs').toExist();
harness.expectFile('dist/browser/app.component.css').toNotExist();
});
});

describe(`'server' is set to 'node-server'`, () => {
beforeEach(() => {
it('should emit browser, media and server files in their respective directories', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
polyfills: [],
Expand All @@ -168,33 +124,19 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
entry: 'src/server.ts',
},
});
});

it(`should emit browser bundles in 'browser' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/browser/main.js').toExist();
});

it(`should emit media files in 'browser/media' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/browser/media/spectrum.png').toExist();
harness.expectFile('dist/browser/media/abc.svg').toExist();
});

it(`should emit server bundles in 'node-server' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/node-server/server.mjs').toExist();
});
});

describe(`'browser' is set to 'public'`, () => {
beforeEach(() => {
it('should emit browser, media and server files in their respective directories', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
polyfills: [],
Expand All @@ -208,51 +150,19 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
entry: 'src/server.ts',
},
});
});

it(`should emit browser bundles in 'public' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/public/main.js').toExist();
});

it(`should emit media files in 'public/media' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/public/media/spectrum.png').toExist();
harness.expectFile('dist/public/media/abc.svg').toExist();
});

it(`should emit server bundles in 'server' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/server/server.mjs').toExist();
});
});

describe(`'browser' is set to ''`, () => {
it(`should emit browser bundles in '' directory`, async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
polyfills: [],
server: 'src/main.server.ts',
outputPath: {
base: 'dist',
browser: '',
},
ssr: false,
});

const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/main.js').toExist();
});

it(`should emit media files in 'media' directory`, async () => {
it('should emit browser and media files in the root output directory when ssr is disabled', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
polyfills: [],
Expand All @@ -268,11 +178,12 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/main.js').toExist();
harness.expectFile('dist/media/spectrum.png').toExist();
harness.expectFile('dist/media/abc.svg').toExist();
});

it(`should error when ssr is enabled`, async () => {
it('should error when ssr is enabled', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
polyfills: [],
Expand All @@ -298,8 +209,8 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
});
});

describe(`'server' is set ''`, () => {
beforeEach(() => {
describe(`'server' is set to ''`, () => {
it('should emit browser, media and server files in their respective directories', async () => {
harness.useTarget('build', {
...BASE_OPTIONS,
polyfills: [],
Expand All @@ -313,27 +224,13 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
entry: 'src/server.ts',
},
});
});

it(`should emit browser bundles in 'browser' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/browser/main.js').toExist();
});

it(`should emit media files in 'browser/media' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/browser/media/spectrum.png').toExist();
harness.expectFile('dist/browser/media/abc.svg').toExist();
});

it(`should emit server bundles in '' directory`, async () => {
const { result } = await harness.executeOnce();
expect(result?.success).toBeTrue();

harness.expectFile('dist/server.mjs').toExist();
});
});
Expand Down
Loading
Loading