blob: 5d564884d105040fcfe794af3722c6561089c53e [file] [log] [blame]
Tommy Martinod770d7e2021-08-12 13:23:10 -04001const playwright = require('playwright');
2// TODO: Re-enable when working on CI
3// process.env.WEBKIT_HEADLESS_BIN = playwright.webkit.executablePath();
4process.env.FIREFOX_HEADLESS_BIN = playwright.firefox.executablePath();
5process.env.CHROMIUM_BIN = playwright.chromium.executablePath();
Tommy Martino76f06cb2020-07-30 19:50:54 -04006
7module.exports = function (config) {
8 config.set({
9 // base path that will be used to resolve all patterns (eg. files, exclude)
Tommy Martino22a04302020-09-28 16:40:49 -040010 basePath: '.',
Tommy Martino76f06cb2020-07-30 19:50:54 -040011
12 // frameworks to use
13 // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
14 frameworks: ['jasmine'],
15
16 // list of files / patterns to load in the browser
17 files: [
Tommy Martino22a04302020-09-28 16:40:49 -040018 { pattern: 'src/*.js', type: 'module' },
Tommy Martino76f06cb2020-07-30 19:50:54 -040019 { pattern: 'test/*.js', type: 'module' },
20 'test/*.html',
21 ],
22
23 // list of files / patterns to exclude
24 exclude: [
Tommy Martino22a04302020-09-28 16:40:49 -040025 'src/text-fragments.js', // so that the polyfill doesn't run in test
Tommy Martino76f06cb2020-07-30 19:50:54 -040026 ],
27
28 // preprocess matching files before serving them to the browser
29 // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
30 preprocessors: {
31 '**/*.html': ['html2js'],
32 },
33
34 // test results reporter to use
35 // possible values: 'dots', 'progress'
36 // available reporters: https://npmjs.org/browse/keyword/karma-reporter
37 reporters: ['progress'],
38
39 // web server port
40 port: 9876,
41
42 // enable / disable colors in the output (reporters and logs)
43 colors: true,
44
45 // level of logging
46 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
47 logLevel: config.LOG_INFO,
48
49 // enable / disable watching file and executing tests whenever any file changes
50 autoWatch: false,
51
52 // start these browsers
Tommy Martinod770d7e2021-08-12 13:23:10 -040053 // TODO: WebkitHeadless would be great to add, but currently is causing issues on CI
54 browsers: ['ChromiumHeadlessNoSandbox', 'FirefoxHeadless'],
Tommy Martino39533482020-10-08 12:14:28 -040055 customLaunchers: {
Tommy Martinod770d7e2021-08-12 13:23:10 -040056 ChromiumHeadlessNoSandbox: {
57 base: 'ChromiumHeadless',
Tommy Martino39533482020-10-08 12:14:28 -040058 flags: ['--no-sandbox']
Ernesto Izquierdo986a3822021-12-21 15:02:59 -050059 },
60 Chrome_with_debugging: {
61 base: 'Chrome',
62 flags: ['--remote-debugging-port=9222'],
63 debug: true
64 },
65 Firefox_with_debugging: {
66 base: 'Firefox',
67 flags: ['--remote-debugging-port=9222'],
68 debug: true
Tommy Martino39533482020-10-08 12:14:28 -040069 }
70 },
Tommy Martino76f06cb2020-07-30 19:50:54 -040071
Tommy Martino44f9f2c2021-02-10 13:02:35 -050072 client: {
73 // We can't run in an iframe because some of the code under test is
74 // checking if it's inside an iframe.
75 useIframe: false,
Ernesto Izquierdo986a3822021-12-21 15:02:59 -050076 debug: config.debug
Tommy Martino44f9f2c2021-02-10 13:02:35 -050077 },
78
Tommy Martino76f06cb2020-07-30 19:50:54 -040079 // Continuous Integration mode
80 // if true, Karma captures browsers, runs the tests and exits
81 singleRun: false,
82
83 // Concurrency level
84 // how many browser should be started simultaneous
85 concurrency: Infinity,
86
87 html2JsPreprocessor: {
88 // strip this from the file path
Tommy Martino6f917982020-08-04 10:19:38 -040089 stripPrefix: 'test/',
Tommy Martino76f06cb2020-07-30 19:50:54 -040090 },
91 });
92};