1 | {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/lib/common/config.ts"],"names":[],"mappings":"","sourcesContent":["import { ReporterOptions } from '../reporters/Reporter';\nimport { BenchmarkReporterOptions } from '../reporters/Benchmark';\nimport { TunnelOptions } from '@theintern/digdug/Tunnel';\nimport { BrowserStackOptions } from '@theintern/digdug/BrowserStackTunnel';\nimport { SeleniumOptions } from '@theintern/digdug/SeleniumTunnel';\n\n/**\n * This interface describes the configuration data used by Intern. Its\n * properties can be set from the command line when running the intern bin\n * script, or via an object passed to the executor's\n * [[lib/executors/Executor.Executor.configure]] method.\n */\nexport interface Config extends ResourceConfig {\n /**\n * By default, Intern will run all configured tests. Setting this option\n * to `true` will cause Intern to stop running tests after the first failure.\n */\n bail: boolean;\n\n baseline: boolean;\n\n /**\n * The path to the project base. This will always end with a path separator\n * (e.g., /).\n */\n basePath: string;\n\n /**\n * This property must be set to `true` for benchmark tests to run. If it is\n * unset or `false`, any suites registered using the benchmark interface will\n * be ignored.\n */\n benchmark: boolean;\n\n benchmarkConfig?: BenchmarkConfig;\n\n browser: ResourceConfig;\n\n /**\n * The global variable that will be used to store coverage data\n */\n coverageVariable: string;\n\n /**\n * When set to true, Intern will emit 'log' events for many internal\n * operations. Reporters that register for these events, such as the Runner\n * reporter, will display them during testing.\n */\n debug: boolean;\n\n /**\n * This is the number of milliseconds that Intern will wait for an\n * [asynchronous test](https://github.com/theintern/intern/blob/master/docs/writing_tests.md#testing-asynchronous-code)\n * to complete before timing out. A timed out test is considered to have\n * failed.\n */\n defaultTimeout: number;\n\n /** A description for this test run */\n description: string;\n\n /**\n * If true, filter external library calls and runtime calls out of error\n * stacks.\n */\n filterErrorStack: boolean;\n\n /**\n * This property is a regular expression that is used to filter which tests\n * are run. Grep operates on test IDs. A test ID is the concatenation of a\n * test name with all of its parent suite names. Every test ID that matches\n * the current grep expression will be run.\n */\n grep: RegExp;\n\n /**\n * The path to Intern. This will always end with a path separator (e.g., /).\n */\n internPath: string;\n\n /** A top-level name for this configuration. */\n name: string;\n\n node: ResourceConfig;\n\n /**\n * An identifier for this test session. By default it will have the value\n * ''.\n */\n sessionId: string;\n\n /** If true, display the resolved config and exit */\n showConfig: boolean;\n\n /**\n * The default capabilities for all test environments.\n *\n * They will be extended for each environment by values in the\n * [`environments`](#environments) array.\n *\n * Cloud testing services such as BrowserStack may have unique capabilities.\n * It’s important to use the proper capabilities for the WebDriver server or\n * cloud service being used to run tests.\n *\n * * [Selenium capabilities](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities)\n * * [BrowserStack capabilities](https://www.browserstack.com/automate/capabilities)\n * * [CrossBrowserTesting capabilities](https://help.crossbrowsertesting.com/selenium-testing/automation-capabilities)\n * * [Sauce Labs capabilities](https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-Selenium-SpecificOptions) and [environments](https://saucelabs.com/platforms)\n * * [TestingBot capabilities](https://testingbot.com/support/other/test-options) and [environments](https://testingbot.com/support/getting-started/browsers.html)\n *\n * [Chrome-specific options](https://sites.google.com/a/chromium.org/chromedriver/capabilities)\n * may be passed using a `goog:chromeOptions` capability.\n *\n * [Firefox-specific options](https://github.com/mozilla/geckodriver#firefox-capabilities)\n * may be passed using a `moz:firefoxOptions` capability.\n *\n * Intern will automatically provide certain capabilities to provide better\n * feedback with cloud service dashboards:\n *\n * * `name` will be set to the name of the test config\n * * `build` will be set to the commit ID from the `TRAVIS_COMMIT` and\n * `BUILD_TAG` environment variables, if either exists\n */\n capabilities: {\n name?: string;\n build?: string;\n [key: string]: any;\n };\n\n /** Time to wait for contact from a remote server */\n connectTimeout: number;\n\n /**\n * An array of file paths or globs that should be instrumented for code\n * coverage, or false to completely disable coverage.\n *\n * This property should point to the actual JavaScript files that will be\n * executed, not pre-transpiled sources (coverage results will still be\n * mapped back to original sources). Coverage data will be collected for\n * these files even if they’re not loaded by Intern for tests, allowing a\n * test writer to see which files _haven’t_ been tested, as well as coverage\n * on files that were tested.\n *\n * When this value is unset, Intern will still look for coverage data on a\n * global coverage variable, and it will request coverage data from remote\n * sessions. Explicitly setting coverage to false will prevent Intern from\n * even checking for coverage data.\n *\n * > 💡This property replaces the `excludeInstrumentation` property used in\n * previous versions of Intern, which acted as a filter rather than an\n * inclusive list.\n */\n coverage: false | string[];\n\n /**\n * The environments that will be used to run tests.\n *\n * Its value can be a single browser name or an environment object, or an\n * array of these.\n *\n * ```js\n * environments: 'chrome'\n * environments: ['chrome', 'firefox']\n * environments: { browserName: 'chrome', version: '57.0' }\n * environments: { browserName: 'chrome', fixSessionCapabilities: false }\n * ```\n *\n * The syntax for browser names and other properties depends on where tests\n * are being run. For example, when running tests using a local Selenium\n * server, the browser name should be the lowercase name of a locally\n * available browser, such as ‘chrome’ or ‘firefox’, and other properties\n * such as the platform name will generally be ignored. When running on a\n * cloud testing service such as [Sauce Labs](https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-RequiredSeleniumTestConfigurationSettings)\n * or [BrowserStack](https://www.browserstack.com/automate/capabilities),\n * browser names and other properties may have different acceptable values\n * (e.g., ‘googlechrome’ instead of ‘chrome’, or ‘MacOS’ vs ‘OSX’).\n *\n * The [fixSessionCapabilities](https://theintern.io/docs.html#Leadfoot/2/api/Server/fixsessioncapabilities)\n * property determines whether feature and defect tests will be run in the\n * remote browser. Setting it to `false` entirely disables feature tests\n * (assuming that all features are enabled), while setting it to\n * `'no-detect'` will set certain already-known feature and defect flags\n * based on the browser and platform. The current set of capabilities are\n * available on `this.remote.session.capabilities` in functional tests.\n *\n * > 💡Note that 'node' is an environment. If no environments are specified,\n * the Node executor will automatically add 'node' to the resolved config.\n * If any environments are specified, though, unit tests will only be run in\n * this environments.\n */\n environments: EnvironmentSpec[];\n\n // Deprecated; this is only here for typing\n excludeInstrumentation: never;\n\n /** The base URL to use for relative addresses in functional tests */\n functionalBaseUrl?: string;\n\n /** Whether to collect coverage data from functional tests */\n functionalCoverage: boolean;\n\n /**\n * A list of paths or glob expressions that point to functional suites.\n *\n * Functional suites are files that register\n * [WebDriver tests](writing_tests.md).\n */\n functionalSuites: string[];\n\n /**\n * Default timeout values for functional tests\n *\n * * **find** is the time to wait for findBy commands to find an element\n * * **executeAsync** is the time to wait for executeAsync calls to\n * complete\n * * **pageLoad** is the time to wait for a page to finish loading\n * synchronous resources\n */\n functionalTimeouts: {\n // Deprecated; this is only here for typing\n connectTimeout?: never;\n\n /** Time to wait for a findBy command to find a matching element */\n find?: number;\n\n /** Time to wait for an executeAsync to complete */\n executeAsync?: number;\n\n /** Time to wait for initial page load to complete */\n pageLoad?: number;\n };\n\n /** How often to send a heartbeat message to a remote browser, in seconds */\n heartbeatInterval?: number;\n\n /**\n * An object containing options for the\n * [Istanbul instrumenter](https://github.com/istanbuljs/istanbuljs/blob/master/packages/istanbul-lib-instrument/api.md#instrumenter).\n */\n instrumenterOptions: { [key: string]: any };\n\n /**\n * Whether to leave the remote browser open after testing.\n *\n * Normally when Intern runs tests on remote browsers, it shuts the browser\n * down when testing is finished. However, you may sometimes want to inspect\n * the state of a remote browser after tests have run, particularly if\n * you're trying to debug why a test is failing. Setting `leaveRemoteOpen`\n * to true will cause Intern to leave the browser open after testing.\n * Setting it to `'fail'` will cause Intern to leave it open only if there\n * were test failures.\n */\n leaveRemoteOpen: boolean | 'fail';\n\n /**\n * The number of concurrent remote test sessions to run at once.\n *\n * The default value is Infinity, meaning Intern will try to run all of its\n * test sessions in parallel. Note that cloud testing services often limit\n * the number of concurrent sessions they will allow to 2 or 5.\n */\n maxConcurrency: number;\n\n /**\n * A proxy that should be used for outgoing web connections. If specified,\n * this will be used for Intern's WebDriver client instead of the Dig Dug\n * tunnel's proxy value.\n */\n proxy?: string;\n\n /**\n * Options to pass to the remote runner.\n */\n remoteOptions: RemoteOptions;\n\n /**\n * If true, a remote will wait for reponses from Intern for any executor\n * events.\n */\n runInSync: boolean;\n\n /** If true, start Intern's static test server but do not run any tests. */\n serveOnly: boolean;\n\n /**\n * The port Intern's static server will listen on during functional tests.\n */\n serverPort: number;\n\n /**\n * The URL a remote should use to access Intern's static server. By default\n * this is http://localhost:9000, but the domain or port may be different if\n * Intern is behind a proxy.\n */\n serverUrl: string;\n\n /**\n * The port that a remote will use to access Intern's websocket server. The\n * hostname will be the same as for serverUrl. For example, if serverPort is\n * set to 9001 and the default serverUrl is used (http://localhost:9000),\n * the full websocket URL will be ws://localhost:9001.\n */\n socketPort?: number;\n\n /**\n * The number of milliseconds to wait before a websocket message is considered\n * to be timed out.\n */\n socketTimeout?: number;\n\n /**\n * The Dig Dug tunnel class to use for WebDriver testing.\n *\n * There are several built in tunnel types, and others can be added through\n * the Node executor’s [`registerPlugin`\n * method](./architecture.md#extension-points).\n *\n * The built in tunnel classes are:\n *\n * * 'null'\n * * 'selenium'\n * * 'browserstack'\n * * 'cbt' (CrossBrowserTesting)\n * * 'saucelabs'\n * * 'testingbot'\n */\n tunnel: string;\n\n /**\n * Options for the currently selected tunnel.\n *\n * The available options depend on the current tunnel. Common options\n * include:\n *\n * ** All tunnels**\n *\n * | Property | Value |\n * | :--- | :--- |\n * | `username` | Username for the tunnel service (e.g., BrowserStack) |\n * | `apiKey` | API key for the tunnel service (e.g., BrowserStack) |\n * | `pathname` | The path for the tunnel’s REST endpoint (e.g., `wd/hub`) |\n *\n * **Selenium tunnel**\n *\n * | Property | Value |\n * | :--- | :--- |\n * | `drivers` | A list of driver names, or objects with `name` and `options` properties |\n * | `verbose` | If true, show tunnel debug information |\n *\n * See also:\n *\n * * [[https://theintern.io/docs.html#Dig%20Dug/2/api/Tunnel/tunnelproperties|Tunnel]]\n * * [[https://theintern.io/docs.html#Dig%20Dug/2/api/SeleniumTunnel/seleniumproperties|SeleniumTunnel]]\n * * [[https://theintern.io/docs.html#Dig%20Dug/2/api/BrowserStackTunnel/browserstackproperties|BrowserStackTunnel]]\n */\n tunnelOptions: TunnelOptions & BrowserStackOptions & SeleniumOptions;\n\n /**\n * By default, an Intern session will fail if the Executor catches a\n * browser-level unhandled Promise rejection. This setting allows unhandled\n * rejections to be treated as warnings instead of failing errors. If this\n * setting is true or set to a RegExp that matches the reason for an unhandled\n * rejection, Intern will emit a warning rather than failing the test run.\n */\n warnOnUnhandledRejection: boolean | RegExp;\n\n /**\n * By default, an Intern session will fail if the Executor catches a\n * browser-level unhandled error. This setting allows unhandled errors to be\n * treated as warnings instead of failing errors. If this setting is true or\n * set to a RegExp that matches an unhandled error, Intern will emit a warning\n * rather than failing the test run.\n */\n warnOnUncaughtException: boolean | RegExp;\n}\n\n/**\n * A descriptor object used to load a built-in reporter\n */\nexport interface ReporterDescriptor {\n name: string;\n options?: ReporterOptions;\n}\n\n/**\n * A descriptor object for a script. If an options value is present, the\n * descriptor is assumed to refer to a plugin, and the options will be passed to\n * the plugins initializer function.\n */\nexport interface PluginDescriptor {\n script: string;\n useLoader?: boolean;\n options?: any;\n}\n\n/**\n * A generic event listener\n */\nexport interface Listener<T> {\n (arg: T): void | PromiseLike<void>;\n}\n\nexport interface ResourceConfig {\n /**\n * The loader used to load test suites and application modules.\n *\n * When passed in as part of a config object, the `loader` property can be a\n * string with a loader name or the path to a loader script. It may also be\n * an object with `script` and `config` properties. Intern provides built-in\n * loader scripts for Dojo and Dojo2, which can be specified with the IDs\n * 'dojo' and 'dojo2'.\n *\n * ```ts\n * loader: 'dojo2'\n * loader: 'tests/loader.js'\n * loader: {\n * script: 'dojo',\n * config: {\n * packages: [\n * { name: 'app', location: './js' }\n * ]\n * }\n * }\n * ```\n */\n loader: LoaderDescriptor;\n\n /**\n * A list of reporter names or descriptors.\n *\n * Reporters specified in this list must have been previously installed\n * using\n * [`registerReporter`](https://theintern.io/docs.html#Intern/4/api/lib%2Fexecutors%2FExecutor/registerreporter)\n * or\n * [`registerPlugin`](https://theintern.io/docs.html#Intern/4/api/lib%2Fexecutors%2FExecutor/registerplugin).\n *\n * List entries may be reporter names or objects of the format\n *\n * ```js\n * {\n * name: 'reporter name',\n * options: {\n * // reporter-specific options\n * }\n * }\n * ```\n *\n * The built-in reporters under Node are:\n * * benchmark - output benchmark test results\n * * cobertura - output coverage data in the cobertura format\n * * htmlcoverage - output coverage data as an HTML report\n * * jsoncoverage - output coverage data in a JSON format\n * * junit - output results in JUnit format\n * * lcov - output coverage results in lcov format\n * * pretty - draw text results in a terminal\n * * runner - output test results as formatted text (default Node reporter)\n * * simple - output test results as simple text\n * * teamcity - output results in TeamCity format\n *\n * The built-in reporters available in browsers are:\n * * console - output to the browser console\n * * dom - output results as text in the DOM\n * * html - output a pretty HTML report (default browser reporter)\n */\n reporters: ReporterDescriptor[];\n\n /**\n * A list of scripts or modules to load before suites are loaded.\n */\n plugins: PluginDescriptor[];\n\n /**\n * A list of paths or glob expressions that point to suite scripts.\n *\n * ```js\n * {\n * suites: [\n * 'tests/unit/**\\/*.js',\n * 'tests/intergration/request.js'\n * ]\n * }\n * ```\n *\n * Note that using globs with the browser client requires that Intern's\n * server be used to serve the tests. The server can be run in standalone\n * mode by setting the `serveOnly` option.\n */\n suites: string[];\n\n /**\n * An optional path to a tsconfig for ts-node, or false if TypeScript\n * support is not needed. This option can be used if tests need to use a\n * different tsconfig than the project uses normally.\n */\n tsconfig?: string | false;\n // Deprecated; these are only here for typing\n require: never;\n requires: never;\n scripts: never;\n}\n\nexport interface BenchmarkConfig extends BenchmarkReporterOptions {\n id: string;\n}\n\nexport interface LoaderDescriptor {\n script: string;\n options?: {\n /**\n * An optional file path for the loader. If unspecified Intern will assume the loader's package is\n * installed in `node_modules`. This property is prefixed with \"intern\" to distinguish it from\n * other properties which will be passed to the loader. If present, Intern will read this property\n * and then filter it out of the config passed to the loader.\n */\n internLoaderPath?: string;\n [key: string]: any;\n };\n}\n\nexport interface EnvironmentSpec {\n browserName: string;\n [key: string]: any;\n}\n\nexport interface RemoteOptions {\n disableDomUpdates: boolean;\n}\n"]} |