Why is the Karma configuration file exclude option is not working?

You can exclude the file in the tsconfig.spec.json:

{
  "extends": "../tsconfig.json",
  "compilerOptions": { ... },
  "files": [
    "test.ts"
  ],
  "include": [
    "**/*.spec.ts",
    "**/*.d.ts"
  ],
  "exclude": [
    "app/app.component-two.spec.ts"    <------------------
  ]

Use src/test.ts

import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
import 'zone.js/dist/zone-testing';

declare const require: {
  context(
    path: string,
    deep?: boolean,
    filter?: RegExp
  ): {
    keys(): string[];
    <T>(id: string): T;
  };
};

const excludedSpecs = ['./app/app.component-two.spec.ts'];

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);

// And load the modules.
context
  .keys()
  .filter(file => excludedSpecs.includes(file) === false)
  .forEach(context);