1 | /**
|
2 | * Copyright 2017 Google Inc. All Rights Reserved.
|
3 | * Licensed under the Apache License, Version 2.0 (the "License");
|
4 | * you may not use this file except in compliance with the License.
|
5 | * You may obtain a copy of the License at
|
6 | * http://www.apache.org/licenses/LICENSE-2.0
|
7 | * Unless required by applicable law or agreed to in writing, software
|
8 | * distributed under the License is distributed on an "AS IS" BASIS,
|
9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10 | * See the License for the specific language governing permissions and
|
11 | * limitations under the License.
|
12 | */
|
13 |
|
14 | module.exports = function (config) {
|
15 | const configuration = {
|
16 | basePath: "",
|
17 | frameworks: ["mocha", "chai", "detectBrowsers"],
|
18 | files: [
|
19 | {
|
20 | pattern: "tests/fixtures/*",
|
21 | included: false,
|
22 | },
|
23 | {
|
24 | pattern: "dist/**/*.@(mjs|js)",
|
25 | included: false,
|
26 | },
|
27 | {
|
28 | pattern: "tests/*.test.js",
|
29 | type: "module",
|
30 | },
|
31 | ],
|
32 | reporters: ["progress"],
|
33 | port: 9876,
|
34 | colors: true,
|
35 | logLevel: config.LOG_INFO,
|
36 | autoWatch: true,
|
37 | singleRun: true,
|
38 | concurrency: Infinity,
|
39 | detectBrowsers: {
|
40 | enabled: true,
|
41 | usePhantomJS: false,
|
42 | preferHeadless: true,
|
43 | postDetection: (availableBrowsers) => {
|
44 | if (process.env.INSIDE_DOCKER) {
|
45 | return ["DockerChrome"];
|
46 | } else if (process.env.CHROME_ONLY) {
|
47 | return ["ChromeHeadless"];
|
48 | } else {
|
49 | // Filtering SafariTechPreview because I am having
|
50 | // local issues and I have no idea how to fix them.
|
51 | // I know that’s not a good reason to disable tests,
|
52 | // but Safari TP is relatively unimportant.
|
53 | return availableBrowsers.filter(
|
54 | (browser) => browser !== "SafariTechPreview"
|
55 | );
|
56 | }
|
57 | },
|
58 | },
|
59 | customLaunchers: {
|
60 | DockerChrome: {
|
61 | base: "ChromeHeadless",
|
62 | flags: ["--no-sandbox"],
|
63 | },
|
64 | },
|
65 | };
|
66 |
|
67 | config.set(configuration);
|
68 | };
|