Skip to content

chore(frontend): remove deprecated Karma/Jasmine/Protractor testing stack#180

Open
Prateekbala wants to merge 5 commits intokserve:masterfrom
Prateekbala:fix/remove-karma-jasmine-protractor
Open

chore(frontend): remove deprecated Karma/Jasmine/Protractor testing stack#180
Prateekbala wants to merge 5 commits intokserve:masterfrom
Prateekbala:fix/remove-karma-jasmine-protractor

Conversation

@Prateekbala
Copy link
Copy Markdown
Contributor

@Prateekbala Prateekbala commented Apr 1, 2026

Summary

Removes deprecated Karma/Jasmine/Protractor testing stack and completes migration to Jest for unit tests.

Changes

  • Removed Karma, Jasmine, and Protractor dependencies
  • Migrated all unit tests to Jest framework
  • Standardized test file naming to *.spec.ts convention
  • Fixed incomplete mock interfaces causing test failures
  • Updated test configuration and documentation

Key Files Modified

  • package.json - Removed deprecated test dependencies
  • jest.config.js - Simplified test pattern matching
  • tsconfig.spec.json - Added path mapping for mocks
  • TEST.md - Updated documentation
  • Test files - Renamed from *.jest.spec.ts to *.spec.ts

Testing

  • All 27 test suites (107 tests) passing
  • Format check: npm run format:check
  • Lint check: npm run lint-check
  • Unit tests with coverage: npm run test:prod
  • E2E tests unaffected (Cypress independent)

Impact

  • Simplifies testing infrastructure
  • Removes deprecated dependencies
  • Standardizes on modern, actively maintained tools
  • Reduces maintenance overhead

Closes #180

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the deprecated Angular Karma/Jasmine and Protractor testing setup from the frontend and standardizes the project on Jest (unit tests) and Cypress (end-to-end tests).

Changes:

  • Removed Karma and Protractor configuration/files (including Angular CLI test / e2e targets).
  • Updated frontend scripts and dependencies to use Jest and Cypress exclusively.
  • Updated unit-test scaffolding/types and refreshed testing documentation.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
frontend/tsconfig.spec.json Removes Jasmine types and Karma’s src/test.ts entry; keeps Jest/node types.
frontend/TEST.md Rewrites testing guide to reflect Jest + Cypress only.
frontend/src/test.ts Deletes Karma bootstrap file.
frontend/src/app/shared/namespace-select/namespace-select.component.spec.ts Replaces Jasmine spies with Jest mocks.
frontend/package.json Switches test/test:prod to Jest; removes Jasmine/Karma/Protractor dependencies; maps e2e to Cypress CI flow.
frontend/package-lock.json Removes top-level deprecated deps but still contains optional peer-installed Protractor/Karma entries.
frontend/karma.conf.js Deletes Karma configuration.
frontend/e2e/tsconfig.json Deletes Protractor e2e TypeScript config.
frontend/e2e/src/app.po.ts Deletes Protractor page object.
frontend/e2e/src/app.e2e-spec.ts Deletes Protractor e2e spec.
frontend/e2e/protractor.conf.js Deletes Protractor configuration.
frontend/angular.json Removes Angular CLI test (Karma) and e2e (Protractor) targets.
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported

Comment thread frontend/package.json
Comment thread frontend/TEST.md
Comment thread frontend/package-lock.json
Comment thread frontend/package-lock.json Outdated
@Prateekbala
Copy link
Copy Markdown
Contributor Author

Resolved the copilot reviews.

Copy link
Copy Markdown
Contributor

@alokdangre alokdangre left a comment

Choose a reason for hiding this comment

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

why two different naming of files 'jest.spec.ts', and 'spec.ts', i think this is inconsistency
@juliusvonkohout @Prateekbala @LogicalGuy77

@abdullahpathan22
Copy link
Copy Markdown

Hello @juliusvonkohout ,
I have found few things to tighten this up before merge:


1. backend.service.spec.ts — dead test needs a real assertion

expect(true).toBeTruthy() is worse than no test — it passes silently and gives false confidence in CI. Replace it with an actual service instantiation:

import { TestBed, waitForAsync } from '@angular/core/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MWABackendService } from './backend.service';

describe('MWABackendService', () => {
  beforeEach(waitForAsync(() => {
    TestBed.configureTestingModule({
      imports: [HttpClientTestingModule, MatSnackBarModule],
      providers: [MWABackendService],
    }).compileComponents();
  }));

  it('should be created', () => {
    const service = TestBed.inject(MWABackendService);
    expect(service).toBeTruthy();
  });
});

2. Simplify jest.config.js — the dual glob is redundant

Since Karma is gone, *.jest.spec.ts is a subset of *.spec.ts. The config can be simplified:

- testMatch: ["**/*.spec.ts", "**/*.jest.spec.ts"],
+ testMatch: ["**/*.spec.ts"],

This still catches inference-graph.component.jest.spec.ts because it ends with .spec.ts. Then rename that file in a follow-up to drop the .jest infix entirely.


3. TEST.md — document the single naming convention

The naming section still lists both patterns. Since Karma is gone, simplify:

 ## Test File Naming
-- Jest unit tests: `*.spec.ts` or `*.jest.spec.ts`
+- Unit tests: `*.spec.ts`
  - Cypress tests: `*.cy.ts`

4. tsconfig.spec.json — stale test-setup.jest.ts naming

Now that Jest is the only runner, consider renaming the setup file from test-setup.jest.ts to just test-setup.ts for consistency with the simplified stack. Not blocking, but a nice cleanup for a follow-up.


5. NO_ERRORS_SCHEMA in 6 specs — acceptable but track it

Shallow testing with NO_ERRORS_SCHEMA is pragmatic for this migration, but it suppresses real Angular template binding errors. Consider opening a follow-up issue to progressively replace it with proper module/component declarations in the specs that matter most (e.g., server-info.component.spec.ts). You don't want to discover broken template bindings in production that tests were silently ignoring.


6. __mocks__/kubeflow.ts — add a version sync comment

The mock is now 260+ lines with @NgModule decorators. If it drifts from the real kubeflow library exports, tests pass but components break at runtime. Add a header comment:

/**
 * Manual mock for the 'kubeflow' package.
 * Last synced with kubeflow frontend lib as of PR #180.
 * If adding new exports, verify they match the real library API.
 */

7. CI runner cleanup opportunity

test:prod changed from ng test --browsers=ChromeHeadless to jest --ci --coverage. If any GitHub Actions workflow was installing Chrome or chromium on the runner solely for unit tests, that dependency can now be dropped — saves ~30s on CI. Worth checking .github/workflows/.


@Prateekbala Prateekbala force-pushed the fix/remove-karma-jasmine-protractor branch 2 times, most recently from 30457b1 to 7f7edd1 Compare April 28, 2026 21:48
Signed-off-by: Prateek Bala <prateekbala28@gmail.com>
Signed-off-by: Prateek Bala <prateekbala28@gmail.com>
Signed-off-by: Prateek Bala <prateekbala28@gmail.com>
Signed-off-by: Prateek Bala <prateekbala28@gmail.com>
@Prateekbala Prateekbala force-pushed the fix/remove-karma-jasmine-protractor branch from f7ac238 to e5880d9 Compare April 28, 2026 21:50
@LogicalGuy77
Copy link
Copy Markdown
Contributor

hi, thanks for the changes @Prateekbala . Can you run the new CI on your fork and see that all tests pass before we merge this?

Signed-off-by: Prateek Bala <prateekbala28@gmail.com>
@Prateekbala Prateekbala force-pushed the fix/remove-karma-jasmine-protractor branch from 754296e to b41a4ca Compare April 29, 2026 23:10
@Prateekbala
Copy link
Copy Markdown
Contributor Author

hi, thanks for the changes @Prateekbala . Can you run the new CI on your fork and see that all tests pass before we merge this?

Screenshot 2026-04-30 at 4 32 35 AM @LogicalGuy77 , This PR only modifies frontend Jest unit tests and configuration—all Jest tests pass locally (27 suites, 107 tests), and the changes don't affect any other workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants