angular/aio/src/test.ts
Paul Gschwendtner ac8b5bffe4 build(docs-infra): update AIO to angular framework/components/cli final RCs (#43583)
Updates AIO to the latest v13 release-candidate version of all
Angular-owned packages, such as Angular CDK and Angular Material.

Applies changes needed for the v13 CLI as performed by the CLI
through `ng update`:

7ff8c5350e/packages/schematics/angular/migrations/update-13.

Additionally, the web components polyfill has been removed as all browsers
supported by Angular seem to support custom elements v1 natively, according to:

* https://caniuse.com/custom-elementsv1
* https://www.webcomponents.org/ (scroll down to browser support)

Co-authored-by: George Kalpakas <kalpakas.g@gmail.com>

PR Close #43583
2021-11-02 17:31:58 -07:00

33 lines
1.1 KiB
TypeScript

// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Needed for `assert` polyfill uses `process`.
// See: https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/assert/assertion_error.js#L138
// The `assert` polyfill is needed because of `timezone-mock` which is a Node.JS library but in being used in Browser.
(globalThis as any).process = {
env: {},
};
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// 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().map(context);