Skip to content
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
11 changes: 0 additions & 11 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
"**/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts",
"**/app/dashboard/component/user/user-workflow/user-workflow-list-item/user-workflow-list-item.component.spec.ts",
"**/app/dashboard/component/user/user-workflow/user-workflow.component.spec.ts",
"**/app/workspace/component/code-editor-dialog/breakpoint-condition-input/breakpoint-condition-input.component.spec.ts",
"**/app/workspace/component/code-editor-dialog/code-debugger.component.spec.ts",
"**/app/workspace/component/code-editor-dialog/code-editor.component.spec.ts",
"**/app/workspace/component/codearea-custom-template/codearea-custom-template.component.spec.ts",
Expand All @@ -115,17 +114,7 @@
"**/app/workspace/component/left-panel/time-travel/time-travel.component.spec.ts",
"**/app/workspace/component/left-panel/versions-list/versions-list.component.spec.ts",
"**/app/workspace/component/menu/menu.component.spec.ts",
"**/app/workspace/component/power-button/computing-unit-selection.component.spec.ts",
"**/app/workspace/component/property-editor/operator-property-edit-frame/operator-property-edit-frame.component.spec.ts",
"**/app/workspace/component/property-editor/port-property-edit-frame/port-property-edit-frame.component.spec.ts",
"**/app/workspace/component/property-editor/property-editor.component.spec.ts",
"**/app/workspace/component/property-editor/typecasting-display/type-casting-display.component.spec.ts",
"**/app/workspace/component/result-panel/console-frame/console-frame.component.spec.ts",
"**/app/workspace/component/result-panel/error-frame/error-frame.component.spec.ts",
"**/app/workspace/component/result-panel/result-panel.component.spec.ts",
"**/app/workspace/component/result-panel/result-table-frame/result-table-frame.component.spec.ts",
"**/app/workspace/component/workflow-editor/context-menu/context-menu/context-menu.component.spec.ts",
"**/app/workspace/component/workflow-editor/mini-map/mini-map.component.spec.ts",
"**/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts",
"**/app/workspace/component/workspace.component.spec.ts",
"**/app/workspace/service/preset/preset.service.spec.ts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ describe("BreakpointConditionInputComponent", () => {
mockUdfDebugService = { getCondition: vi.fn(), doUpdateBreakpointCondition: vi.fn() };

await TestBed.configureTestingModule({
imports: [CommonModule, FormsModule],
declarations: [BreakpointConditionInputComponent],
imports: [BreakpointConditionInputComponent, CommonModule, FormsModule],
providers: [{ provide: UdfDebugService, useValue: mockUdfDebugService }, ...commonTestProviders],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ describe("PowerButtonComponent", () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ComputingUnitSelectionComponent], // Declare if not standalone
imports: [
ComputingUnitSelectionComponent,
HttpClientTestingModule, // Use TestingModule instead of HttpClientModule
CommonModule,
NzButtonModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ describe("PortPropertyEditFrameComponent", () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PortPropertyEditFrameComponent],
providers: [WorkflowActionService, ...commonTestProviders],
imports: [HttpClientTestingModule],
imports: [PortPropertyEditFrameComponent, HttpClientTestingModule],
}).compileComponents();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { CommonModule } from "@angular/common";
import { NO_ERRORS_SCHEMA } from "@angular/core";
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { PropertyEditorComponent } from "./property-editor.component";
import {
mockPoint,
Expand All @@ -40,16 +40,15 @@ describe("PropertyEditorComponent", () => {
let fixture: ComponentFixture<PropertyEditorComponent>;
let workflowActionService: WorkflowActionService;

beforeEach(waitForAsync(() => {
beforeEach(async () => {
TestBed.overrideComponent(PropertyEditorComponent, {
set: {
template: '<div id="right-container"><div #contentWrapper></div></div>',
},
});

TestBed.configureTestingModule({
declarations: [PropertyEditorComponent],
imports: [CommonModule, HttpClientTestingModule],
await TestBed.configureTestingModule({
imports: [PropertyEditorComponent, CommonModule, HttpClientTestingModule],
providers: [
{
provide: OperatorMetadataService,
Expand All @@ -60,7 +59,7 @@ describe("PropertyEditorComponent", () => {
],
schemas: [NO_ERRORS_SCHEMA],
}).compileComponents();
}));
});

beforeEach(() => {
fixture = TestBed.createComponent(PropertyEditorComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { HttpClientTestingModule } from "@angular/common/http/testing";
import { WorkflowCompilingService } from "../../../service/compile-workflow/workflow-compiling.service";

Expand All @@ -34,9 +34,9 @@ describe("TypecastingDisplayComponent", () => {
let component: TypeCastingDisplayComponent;
let fixture: ComponentFixture<TypeCastingDisplayComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [TypeCastingDisplayComponent, HttpClientTestingModule],
providers: [
{
provide: OperatorMetadataService,
Expand All @@ -49,9 +49,8 @@ describe("TypecastingDisplayComponent", () => {
WorkflowCompilingService,
...commonTestProviders,
],
declarations: [TypeCastingDisplayComponent],
}).compileComponents();
}));
});

beforeEach(() => {
fixture = TestBed.createComponent(TypeCastingDisplayComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { ConsoleFrameComponent } from "./console-frame.component";
import { OperatorMetadataService } from "../../../service/operator-metadata/operator-metadata.service";
Expand All @@ -32,10 +32,9 @@ describe("ConsoleFrameComponent", () => {
let component: ConsoleFrameComponent;
let fixture: ComponentFixture<ConsoleFrameComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, NzDropDownModule],
declarations: [ConsoleFrameComponent],
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ConsoleFrameComponent, HttpClientTestingModule, NzDropDownModule],
providers: [
{
provide: OperatorMetadataService,
Expand All @@ -48,7 +47,7 @@ describe("ConsoleFrameComponent", () => {
...commonTestProviders,
],
}).compileComponents();
}));
});

beforeEach(() => {
fixture = TestBed.createComponent(ConsoleFrameComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { ErrorFrameComponent } from "./error-frame.component";
import { OperatorMetadataService } from "../../../service/operator-metadata/operator-metadata.service";
Expand All @@ -28,14 +28,13 @@ import { ComputingUnitStatusService } from "../../../../common/service/computing
import { MockComputingUnitStatusService } from "../../../../common/service/computing-unit/computing-unit-status/mock-computing-unit-status.service";
import { commonTestProviders } from "../../../../common/testing/test-utils";

describe("ConsoleFrameComponent", () => {
describe("ErrorFrameComponent", () => {
let component: ErrorFrameComponent;
let fixture: ComponentFixture<ErrorFrameComponent>;
Comment thread
Yicong-Huang marked this conversation as resolved.

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, NzDropDownModule],
declarations: [ErrorFrameComponent],
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ErrorFrameComponent, HttpClientTestingModule, NzDropDownModule],
providers: [
{
provide: OperatorMetadataService,
Expand All @@ -48,7 +47,7 @@ describe("ConsoleFrameComponent", () => {
...commonTestProviders,
],
}).compileComponents();
}));
});

beforeEach(() => {
fixture = TestBed.createComponent(ErrorFrameComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { ResultPanelComponent } from "./result-panel.component";
import { ExecuteWorkflowService } from "../../service/execute-workflow/execute-workflow.service";
Expand All @@ -39,10 +39,9 @@ describe("ResultPanelComponent", () => {
let executeWorkflowService: ExecuteWorkflowService;
let workflowActionService: WorkflowActionService;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ResultPanelComponent],
imports: [HttpClientTestingModule, NzModalModule],
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ResultPanelComponent, HttpClientTestingModule, NzModalModule],
providers: [
WorkflowActionService,
ExecuteWorkflowService,
Expand All @@ -54,7 +53,7 @@ describe("ResultPanelComponent", () => {
...commonTestProviders,
],
}).compileComponents();
}));
});

beforeEach(() => {
fixture = TestBed.createComponent(ResultPanelComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { ResultTableFrameComponent } from "./result-table-frame.component";
import { OperatorMetadataService } from "../../../service/operator-metadata/operator-metadata.service";
Expand All @@ -31,10 +31,9 @@ describe("ResultTableFrameComponent", () => {
let component: ResultTableFrameComponent;
let fixture: ComponentFixture<ResultTableFrameComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, NzModalModule],
declarations: [ResultTableFrameComponent],
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ResultTableFrameComponent, HttpClientTestingModule, NzModalModule],
providers: [
{
provide: OperatorMetadataService,
Expand All @@ -51,7 +50,7 @@ describe("ResultTableFrameComponent", () => {
...commonTestProviders,
],
}).compileComponents();
}));
});

beforeEach(() => {
fixture = TestBed.createComponent(ResultTableFrameComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { OperatorMetadataService } from "src/app/workspace/service/operator-meta
import { StubOperatorMetadataService } from "src/app/workspace/service/operator-metadata/stub-operator-metadata.service";

import { ContextMenuComponent } from "./context-menu.component";
import { HttpClientModule } from "@angular/common/http";
import { HttpClientTestingModule } from "@angular/common/http/testing";
import { WorkflowActionService } from "src/app/workspace/service/workflow-graph/model/workflow-action.service";
import { WorkflowResultService } from "src/app/workspace/service/workflow-result/workflow-result.service";
import { WorkflowResultExportService } from "src/app/workspace/service/workflow-result-export/workflow-result-export.service";
Expand Down Expand Up @@ -104,7 +104,6 @@ describe("ContextMenuComponent", () => {
const validationWorkflowServiceSpy = { validateOperator: vi.fn() };

await TestBed.configureTestingModule({
declarations: [ContextMenuComponent],
providers: [
{ provide: OperatorMetadataService, useClass: StubOperatorMetadataService },
{ provide: WorkflowActionService, useValue: workflowActionServiceSpy },
Expand All @@ -116,7 +115,8 @@ describe("ContextMenuComponent", () => {
...commonTestProviders,
],
imports: [
HttpClientModule,
ContextMenuComponent,
HttpClientTestingModule,
ReactiveFormsModule,
Comment thread
Yicong-Huang marked this conversation as resolved.
BrowserAnimationsModule,
NzDropDownModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
* under the License.
*/

import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { HttpClientTestingModule } from "@angular/common/http/testing";
import { MiniMapComponent } from "./mini-map.component";
import { WorkflowEditorComponent } from "../workflow-editor.component";
import { WorkflowActionService } from "../../../service/workflow-graph/model/workflow-action.service";
import { OperatorMetadataService } from "../../../service/operator-metadata/operator-metadata.service";
import { StubOperatorMetadataService } from "../../../service/operator-metadata/stub-operator-metadata.service";
Expand All @@ -33,9 +32,8 @@ import { commonTestProviders } from "../../../../common/testing/test-utils";
describe("MiniMapComponent", () => {
let fixture: ComponentFixture<MiniMapComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [MiniMapComponent, WorkflowEditorComponent],
beforeEach(async () => {
await TestBed.configureTestingModule({
providers: [
WorkflowActionService,
WorkflowUtilService,
Expand All @@ -47,9 +45,9 @@ describe("MiniMapComponent", () => {
},
...commonTestProviders,
],
imports: [HttpClientTestingModule, DragDropModule],
imports: [MiniMapComponent, HttpClientTestingModule, DragDropModule],
}).compileComponents();
}));
});

beforeEach(() => {
fixture = TestBed.createComponent(MiniMapComponent);
Expand Down
28 changes: 28 additions & 0 deletions frontend/src/jsdom-svg-polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,31 @@ class InertWebSocket {
constructor(_url?: string, _protocols?: string | string[]) {}
}
(globalThis as unknown as { WebSocket: typeof InertWebSocket }).WebSocket = InertWebSocket;

/**
* NgZorro's NzIconService dynamically fetches icon SVGs over HTTP from
* `/assets/...` when the icon isn't pre-registered. jsdom's XHR
* implementation rejects those requests with an `AggregateError`, and
* downstream the icon lookup re-throws as `IconNotFoundError`. Vitest
* catches both as unhandled errors, which CI treats as a hard failure
* (locally Vitest only reports them as non-fatal warnings).
*
* Stubbing every spec with `NzIconModule.forChild([...])` for every
* icon its template uses is impractical — there are dozens. Instead,
* suppress the two specific error patterns at the process level: they
* originate inside ngZorro's icon plumbing and don't affect the
* assertions specs actually make.
*/
function isBenignIconError(err: unknown): boolean {
const msg = err instanceof Error ? err.message : String(err);
return (
msg.includes("[@ant-design/icons-angular]") ||
(err instanceof Error && err.name === "AggregateError" && /xhr-utils/.test(err.stack ?? ""))
);
}
process.on("uncaughtException", err => {
if (!isBenignIconError(err)) throw err;
});
process.on("unhandledRejection", reason => {
if (!isBenignIconError(reason)) throw reason;
});
15 changes: 4 additions & 11 deletions frontend/src/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
"**/app/dashboard/component/user/user-project/user-project-list-item/user-project-list-item.component.spec.ts",
"**/app/dashboard/component/user/user-workflow/user-workflow-list-item/user-workflow-list-item.component.spec.ts",
"**/app/dashboard/component/user/user-workflow/user-workflow.component.spec.ts",
"**/app/workspace/component/code-editor-dialog/breakpoint-condition-input/breakpoint-condition-input.component.spec.ts",
// monaco-editor + jsdom: missing CSS parser, queryCommandSupported, ProxyZone for nested fakeAsync.
"**/app/workspace/component/code-editor-dialog/code-debugger.component.spec.ts",
"**/app/workspace/component/code-editor-dialog/code-editor.component.spec.ts",
// monaco-editor CSS parsing fails under jsdom.
"**/app/workspace/component/codearea-custom-template/codearea-custom-template.component.spec.ts",
"**/app/workspace/component/left-panel/left-panel.component.spec.ts",
"**/app/workspace/component/left-panel/operator-menu/operator-label/operator-label.component.spec.ts",
Expand All @@ -46,17 +47,9 @@
"**/app/workspace/component/left-panel/time-travel/time-travel.component.spec.ts",
"**/app/workspace/component/left-panel/versions-list/versions-list.component.spec.ts",
"**/app/workspace/component/menu/menu.component.spec.ts",
"**/app/workspace/component/power-button/computing-unit-selection.component.spec.ts",
// formly + nz registers `snippets-o` icon dynamically over HTTP, which jsdom rejects.
"**/app/workspace/component/property-editor/operator-property-edit-frame/operator-property-edit-frame.component.spec.ts",
"**/app/workspace/component/property-editor/port-property-edit-frame/port-property-edit-frame.component.spec.ts",
"**/app/workspace/component/property-editor/property-editor.component.spec.ts",
"**/app/workspace/component/property-editor/typecasting-display/type-casting-display.component.spec.ts",
"**/app/workspace/component/result-panel/console-frame/console-frame.component.spec.ts",
"**/app/workspace/component/result-panel/error-frame/error-frame.component.spec.ts",
"**/app/workspace/component/result-panel/result-panel.component.spec.ts",
"**/app/workspace/component/result-panel/result-table-frame/result-table-frame.component.spec.ts",
"**/app/workspace/component/workflow-editor/context-menu/context-menu/context-menu.component.spec.ts",
"**/app/workspace/component/workflow-editor/mini-map/mini-map.component.spec.ts",
// jointjs paper math relies on real getScreenCTM, which jsdom returns as null.
"**/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts",
"**/app/workspace/component/workspace.component.spec.ts",
"**/app/workspace/service/preset/preset.service.spec.ts"
Expand Down
Loading