UNPKG

3.01 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2017 Google LLC. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 * =============================================================================
16 */
17import { KernelBackend } from './backends/backend';
18import { Environment, Flags } from './environment';
19export declare type Constraints = {
20 flags?: Flags;
21 predicate?: (testEnv: TestEnv) => boolean;
22};
23export declare const NODE_ENVS: Constraints;
24export declare const CHROME_ENVS: Constraints;
25export declare const BROWSER_ENVS: Constraints;
26export declare const SYNC_BACKEND_ENVS: Constraints;
27export declare const HAS_WORKER: {
28 predicate: () => boolean;
29};
30export declare const HAS_NODE_WORKER: {
31 predicate: () => boolean;
32};
33export declare const ALL_ENVS: Constraints;
34export declare function envSatisfiesConstraints(env: Environment, testEnv: TestEnv, constraints: Constraints): boolean;
35export interface TestFilter {
36 include?: string;
37 startsWith?: string;
38 excludes?: string[];
39}
40/**
41 * Add test filtering logic to Jasmine's specFilter hook.
42 *
43 * @param testFilters Used for include a test suite, with the ability
44 * to selectively exclude some of the tests.
45 * Either `include` or `startsWith` must exist for a `TestFilter`.
46 * Tests that have the substrings specified by the include or startsWith
47 * will be included in the test run, unless one of the substrings specified
48 * by `excludes` appears in the name.
49 * @param customInclude Function to programatically include a test.
50 * If this function returns true, a test will immediately run. Otherwise,
51 * `testFilters` is used for fine-grained filtering.
52 *
53 * If a test is not handled by `testFilters` or `customInclude`, the test will
54 * be excluded in the test run.
55 */
56export declare function setupTestFilters(testFilters: TestFilter[], customInclude: (name: string) => boolean): void;
57export declare function parseTestEnvFromKarmaFlags(args: string[], registeredTestEnvs: TestEnv[]): TestEnv;
58export declare function describeWithFlags(name: string, constraints: Constraints, tests: (env: TestEnv) => void): void;
59export interface TestEnv {
60 name: string;
61 backendName: string;
62 flags?: Flags;
63 isDataSync?: boolean;
64}
65export declare const TEST_ENVS: TestEnv[];
66export declare function setTestEnvs(testEnvs: TestEnv[]): void;
67export declare function registerTestEnv(testEnv: TestEnv): void;
68export declare class TestKernelBackend extends KernelBackend {
69 dispose(): void;
70}