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Ae,CAAC,CAAC;SAC/C;QACD,OAAO,IAAI,CAAC;IACd,CAAC","sourcesContent":["import { existsSync, readFileSync } from 'fs';\nimport { dirname, normalize, resolve, sep } from 'path';\nimport { sync as nodeResolve } from 'resolve';\nimport { CoverageMap, createCoverageMap } from 'istanbul-lib-coverage';\nimport { createInstrumenter, Instrumenter } from 'istanbul-lib-instrument';\nimport { createSourceMapStore, MapStore } from 'istanbul-lib-source-maps';\nimport {\n hookRunInThisContext,\n hookRequire,\n unhookRunInThisContext,\n} from 'istanbul-lib-hook';\nimport { register } from 'ts-node';\nimport { global, Task, CancellablePromise, deepMixin } from '@theintern/common';\nimport Command from '@theintern/leadfoot/Command';\nimport LeadfootServer from '@theintern/leadfoot/Server';\nimport Tunnel, { DownloadProgressEvent } from '@theintern/digdug/Tunnel';\n\n// Dig Dug tunnels\nimport SeleniumTunnel, {\n DriverDescriptor,\n} from '@theintern/digdug/SeleniumTunnel';\nimport BrowserStackTunnel, {\n BrowserStackOptions,\n} from '@theintern/digdug/BrowserStackTunnel';\nimport SauceLabsTunnel from '@theintern/digdug/SauceLabsTunnel';\nimport TestingBotTunnel from '@theintern/digdug/TestingBotTunnel';\nimport CrossBrowserTestingTunnel from '@theintern/digdug/CrossBrowserTestingTunnel';\nimport NullTunnel from '@theintern/digdug/NullTunnel';\n\nimport { Config, EnvironmentSpec } from '../common/config';\nimport Executor, { Events, Plugins } from './Executor';\nimport { normalizePathEnding } from '../common/path';\nimport { pullFromArray } from '../common/util';\nimport { expandFiles, readSourceMap, transpileSource } from '../node/util';\nimport ErrorFormatter from '../node/ErrorFormatter';\nimport ProxiedSession from '../ProxiedSession';\nimport Environment from '../Environment';\nimport resolveEnvironments from '../resolveEnvironments';\nimport Server from '../Server';\nimport Suite, { isSuite } from '../Suite';\nimport RemoteSuite from '../RemoteSuite';\nimport { RuntimeEnvironment } from '../types';\nimport * as console from '../common/console';\n\n// Reporters\nimport Pretty from '../reporters/Pretty';\nimport Runner from '../reporters/Runner';\nimport Simple from '../reporters/Simple';\nimport JUnit from '../reporters/JUnit';\nimport Cobertura from '../reporters/Cobertura';\nimport JsonCoverage from '../reporters/JsonCoverage';\nimport HtmlCoverage from '../reporters/HtmlCoverage';\nimport Lcov from '../reporters/Lcov';\nimport Benchmark from '../reporters/Benchmark';\nimport TeamCity from '../reporters/TeamCity';\n\nconst process: NodeJS.Process = global.process;\n\nexport default class Node extends Executor<NodeEvents, Config, NodePlugins> {\n server: Server | undefined;\n tunnel: Tunnel | undefined;\n\n protected _coverageMap: CoverageMap;\n protected _coverageFiles: string[];\n protected _loadingFunctionalSuites: boolean | undefined;\n protected _instrumentBasePath: string | undefined;\n protected _instrumenter: Instrumenter | undefined;\n protected _sourceMaps: MapStore;\n protected _instrumentedMaps: MapStore;\n protected _unhookRequire: (() => void) | undefined;\n protected _sessionSuites: Suite[] | undefined;\n\n constructor(options?: { [key in keyof Config]?: any }) {\n super({\n basePath: process.cwd() + sep,\n capabilities: {},\n coverage: [],\n environments: [],\n functionalCoverage: true,\n functionalSuites: [],\n functionalTimeouts: {},\n instrumenterOptions: {},\n maxConcurrency: Infinity,\n name: 'node',\n reporters: [],\n runInSync: false,\n serveOnly: false,\n serverPort: 9000,\n serverUrl: '',\n socketPort: 9001,\n socketTimeout: 10000,\n tunnel: 'selenium',\n tunnelOptions: { tunnelId: String(Date.now()) },\n });\n\n this._coverageFiles = [];\n this._sourceMaps = createSourceMapStore();\n this._instrumentedMaps = createSourceMapStore();\n this._errorFormatter = new ErrorFormatter(this);\n this._coverageMap = createCoverageMap();\n\n this.registerReporter('pretty', (options) => new Pretty(this, options));\n this.registerReporter('simple', (options) => new Simple(this, options));\n this.registerReporter('runner', (options) => new Runner(this, options));\n this.registerReporter(\n 'benchmark',\n (options) => new Benchmark(this, options)\n );\n this.registerReporter('junit', (options) => new JUnit(this, options));\n this.registerReporter(\n 'jsoncoverage',\n (options) => new JsonCoverage(this, options)\n );\n this.registerReporter(\n 'htmlcoverage',\n (options) => new HtmlCoverage(this, options)\n );\n this.registerReporter('lcov', (options) => new Lcov(this, options));\n this.registerReporter(\n 'cobertura',\n (options) => new Cobertura(this, options)\n );\n this.registerReporter('teamcity', (options) => new TeamCity(this, options));\n\n this.registerTunnel('null', NullTunnel);\n this.registerTunnel('selenium', SeleniumTunnel);\n this.registerTunnel('saucelabs', SauceLabsTunnel);\n this.registerTunnel('browserstack', BrowserStackTunnel);\n this.registerTunnel('testingbot', TestingBotTunnel);\n this.registerTunnel('cbt', CrossBrowserTestingTunnel);\n\n if (options) {\n this.configure(options);\n }\n\n // Report uncaught errors\n process.on(\n 'unhandledRejection',\n (reason: {} | null | undefined, promise: Promise<any>) => {\n console.warn('Unhandled rejection:', reason, promise);\n const { warnOnUnhandledRejection } = this.config;\n if (\n warnOnUnhandledRejection &&\n (warnOnUnhandledRejection === true ||\n warnOnUnhandledRejection.test(`${reason}`))\n ) {\n this.emit('warning', `${reason}`);\n } else {\n this.emit('error', reason as Error);\n }\n }\n );\n\n process.on('uncaughtException', (reason: Error) => {\n console.warn('Unhandled error:', reason);\n if (\n this.config.warnOnUncaughtException &&\n (this.config.warnOnUncaughtException === true ||\n this.config.warnOnUncaughtException.test(`${reason}`))\n ) {\n this.emit('warning', `${reason}`);\n } else {\n this.emit('error', reason);\n }\n });\n\n this.on('coverage', (message) => {\n this._coverageMap.merge(message.coverage);\n });\n }\n\n get coverageMap() {\n return this._coverageMap;\n }\n\n get environment(): RuntimeEnvironment {\n return 'node';\n }\n\n get instrumentedMapStore() {\n return this._instrumentedMaps;\n }\n\n get sourceMapStore() {\n return this._sourceMaps;\n }\n\n get hasCoveredFiles() {\n return this._coverageFiles.length > 0;\n }\n\n /**\n * The root suites managed by this executor\n */\n get suites() {\n const suites = [];\n\n // Only include the rootSuite if some suites were added to it.\n if (this._rootSuite.tests.length > 0) {\n suites.push(this._rootSuite);\n }\n\n if (this._sessionSuites) {\n suites.push(...this._sessionSuites);\n }\n\n return suites;\n }\n\n /**\n * Override Executor#addSuite to handle functional suites\n */\n addSuite(factory: (parentSuite: Suite) => void) {\n if (this._loadingFunctionalSuites) {\n this._sessionSuites!.forEach(factory);\n } else {\n super.addSuite(factory);\n }\n }\n\n /**\n * Retrieve a registered tunnel constructor\n */\n getTunnel(name: string): typeof Tunnel {\n return this.getPlugin<typeof Tunnel>(`tunnel.${name}`);\n }\n\n /**\n * Insert coverage instrumentation into a given code string\n */\n instrumentCode(\n code: string,\n filename: string,\n shouldCompile?: boolean\n ): string {\n this.log('Instrumenting', filename);\n if (filename.endsWith('.d.ts')) {\n return code;\n }\n\n if (shouldCompile) {\n return transpileSource(filename, code);\n }\n\n const sourceMap = readSourceMap(filename, code);\n if (sourceMap) {\n this._sourceMaps.registerMap(filename, sourceMap);\n }\n\n try {\n const instrumenter = this._instrumenter!;\n const newCode = instrumenter.instrumentSync(\n code,\n normalize(filename),\n sourceMap\n );\n\n this._coverageMap.addFileCoverage(instrumenter.lastFileCoverage());\n this._instrumentedMaps.registerMap(\n filename,\n instrumenter.lastSourceMap()\n );\n\n return newCode;\n } catch (error) {\n this.emit('warning', `Error instrumenting ${filename}: ${error.message}`);\n }\n return code;\n }\n\n /**\n * Load scripts using Node's require\n */\n loadScript(script: string | string[]): CancellablePromise<void> {\n const scripts = Array.isArray(script) ? script : [script];\n\n try {\n for (const script of scripts) {\n const file = resolve(script);\n if (existsSync(file)) {\n require(file);\n } else {\n // `script` isn't a valid file path, so maybe it's a\n // Node-resolvable module\n require(nodeResolve(script, { basedir: process.cwd() }));\n }\n }\n } catch (error) {\n return Task.reject<void>(error);\n }\n\n return Task.resolve();\n }\n\n /**\n * Register a tunnel constructor with the plugin system. It can be retrieved\n * later with getTunnel or getPlugin.\n */\n registerTunnel(name: string, Ctor: typeof Tunnel) {\n this.registerPlugin('tunnel', name, () => Ctor);\n }\n\n /**\n * Return true if a given file should be instrumented based on the current\n * config\n */\n shouldInstrumentFile(filename: string): boolean {\n if (this._coverageFiles.indexOf(filename) !== -1) {\n return !(filename in this._instrumentedMaps.data);\n }\n return false;\n }\n\n protected _afterRun() {\n return super._afterRun().finally(() => {\n this._removeInstrumentationHooks();\n\n const promises: Promise<any>[] = [];\n if (this.server) {\n promises.push(\n this.server\n .stop()\n .then(() => this.emit('serverEnd', <any>this.server))\n );\n }\n if (this.tunnel) {\n const tunnel = this.tunnel;\n promises.push(\n tunnel.stop().then(() => this.emit('tunnelStop', { tunnel }))\n );\n }\n // We do not want to actually return an array of values, so chain a\n // callback that resolves to undefined\n return Promise.all(promises).then(\n () => {},\n (error) => this.emit('error', error)\n );\n });\n }\n\n protected _beforeRun() {\n return super._beforeRun().then(() => {\n const config = this.config;\n\n const suite = this._rootSuite;\n suite.grep = config.grep;\n suite.timeout = config.defaultTimeout;\n suite.bail = config.bail;\n\n if (\n // Only start the server if there are remote environments *and*\n // either functionalSuites or browser suites\n (config.environments.filter(isRemoteEnvironment).length > 0 &&\n config.functionalSuites.length + config.browser.suites.length > 0) ||\n // User can start the server without planning to run functional\n // tests\n config.serveOnly\n ) {\n const serverTask: CancellablePromise<void> = new Task<void>(\n (resolve, reject) => {\n const server: Server = new Server({\n basePath: config.basePath,\n executor: this,\n port: config.serverPort,\n runInSync: config.runInSync,\n socketPort: config.socketPort,\n });\n\n server\n .start()\n .then(() => {\n this.server = server;\n return this.emit('serverStart', server);\n })\n .then(resolve, reject);\n }\n );\n\n // If we're in serveOnly mode, just start the server server.\n // Don't create session suites or start a tunnel.\n if (config.serveOnly) {\n return serverTask.then(() => {\n // In serveOnly mode we just start the server to static\n // file serving and instrumentation. Return an\n // unresolved Task to pause indefinitely until canceled.\n return new Task<boolean>((resolve) => {\n process.on('SIGINT', () => {\n resolve(true);\n });\n });\n });\n }\n\n return serverTask\n .then(() => {\n // Tunnel will have been created in resolveConfig\n const tunnel = this.tunnel!;\n\n this._createSessionSuites();\n\n return tunnel\n .start()\n .then(() => this.emit('tunnelStart', { tunnel }));\n })\n .then(() => {\n return false;\n });\n }\n\n return false;\n });\n }\n\n protected _createTunnel() {\n const config = this.config;\n const tunnelOptions = config.tunnelOptions;\n if (config.tunnel === 'browserstack') {\n const options = <BrowserStackOptions>tunnelOptions;\n options.servers = options.servers || [];\n options.servers.push(config.serverUrl);\n }\n\n if ('proxy' in config && !('proxy' in tunnelOptions)) {\n tunnelOptions.proxy = config.proxy;\n }\n\n const TunnelConstructor = this.getTunnel(config.tunnel);\n const tunnel = new TunnelConstructor(this.config.tunnelOptions);\n this.tunnel = tunnel;\n\n tunnel.on('downloadprogress', (progress) => {\n this.emit('tunnelDownloadProgress', {\n tunnel,\n progress,\n });\n });\n\n tunnel.on('status', (status) => {\n this.emit('tunnelStatus', {\n tunnel,\n status: status.status,\n });\n });\n\n return tunnel;\n }\n\n /**\n * Creates suites for each environment in which tests will be executed. This\n * method will only be called if there are both environments and suites to\n * run.\n */\n protected _createSessionSuites(): void {\n if (!this.tunnel) {\n this.log('No tunnel - Not creating session suites');\n return;\n }\n\n const tunnel = this.tunnel;\n const config = this.config;\n\n const leadfootServer = new LeadfootServer(tunnel.clientUrl, {\n proxy: 'proxy' in config ? config.proxy : tunnel.proxy,\n });\n\n const executor = this;\n\n // Create a subclass of ProxiedSession here that will ensure the\n // executor is set\n class InitializedProxiedSession extends ProxiedSession {\n executor = executor;\n coverageVariable = config.coverageVariable;\n baseUrl = config.functionalBaseUrl || config.serverUrl;\n }\n\n leadfootServer.sessionConstructor = InitializedProxiedSession;\n\n // config.environments was resolved in resolveConfig\n this._sessionSuites = this.config.environments\n .filter(isRemoteEnvironment)\n .map((environmentType) => {\n let session: ProxiedSession;\n\n // Create a new root suite for each environment\n const suite = new Suite({\n name: String(environmentType),\n publishAfterSetup: true,\n grep: config.grep,\n bail: config.bail,\n tests: [],\n timeout: config.defaultTimeout,\n executor: this,\n\n before() {\n executor.log('Creating session for', environmentType);\n return leadfootServer\n .createSession<ProxiedSession>(environmentType)\n .then((_session) => {\n session = _session;\n this.executor.log('Created session:', session.capabilities);\n\n const remote: Remote = <Remote>new Command(session);\n remote.environmentType = new Environment(session.capabilities);\n remote.requestedEnvironment = environmentType;\n this.remote = remote;\n this.sessionId = remote.session.sessionId;\n\n // Update the name with details from the remote\n // environment\n this.name = remote.environmentType.toString();\n\n const timeouts = config.functionalTimeouts;\n let promise = Promise.resolve();\n if (timeouts.executeAsync != null) {\n promise = promise.then(() =>\n remote.setExecuteAsyncTimeout(timeouts.executeAsync!)\n );\n this.executor.log(\n 'Set remote executeAsync timeout to ',\n timeouts.executeAsync\n );\n }\n if (timeouts.find != null) {\n promise = promise.then(() =>\n remote.setFindTimeout(timeouts.find!)\n );\n this.executor.log(\n 'Set remote find timeout to ',\n timeouts.find\n );\n }\n if (timeouts.pageLoad != null) {\n promise = promise.then(() =>\n remote.setPageLoadTimeout(timeouts.pageLoad!)\n );\n this.executor.log(\n 'Set remote pageLoad timeout to ',\n timeouts.pageLoad\n );\n }\n\n return promise;\n });\n },\n\n after() {\n const remote = this.remote;\n\n if (remote != null) {\n const endSession = () => {\n // Check for an error in this suite or a\n // sub-suite. This check is a bit more involved\n // than just checking for a local suite error or\n // failed tests since sub-suites may have\n // failures that don't result in failed tests.\n function hasError(suite: Suite): boolean {\n if (suite.error != null || suite.numFailedTests > 0) {\n return true;\n }\n return suite.tests.filter(isSuite).some(hasError);\n }\n return tunnel.sendJobState(remote.session.sessionId, {\n success: !hasError(this),\n });\n };\n\n if (\n config.leaveRemoteOpen === true ||\n (config.leaveRemoteOpen === 'fail' && this.numFailedTests > 0)\n ) {\n return endSession();\n }\n\n return remote.quit().finally(endSession);\n }\n },\n });\n\n // If browser-compatible unit tests were added to this executor,\n // add a RemoteSuite to the session suite. The RemoteSuite will\n // run the suites listed in config.browser.suites.\n if (config.browser.suites.length > 0) {\n suite.add(new RemoteSuite());\n }\n\n return suite;\n });\n }\n\n /**\n * Load functional test suites\n */\n protected _loadFunctionalSuites(): CancellablePromise<void> {\n this._loadingFunctionalSuites = true;\n const suites = this.config.functionalSuites;\n\n // Set the instrumentation hooks if necessary\n if (\n this.config.functionalCoverage !== false &&\n !this._unhookRequire &&\n this.hasCoveredFiles\n ) {\n this._setInstrumentationHooks();\n }\n\n return Task.resolve(this._loader(suites))\n .then(() => {\n this.log('Loaded functional suites:', suites);\n })\n .finally(() => {\n this._loadingFunctionalSuites = false;\n });\n }\n\n /**\n * Override Executor#_loadSuites to set instrumentation hooks before loading\n * suites\n */\n protected _loadSuites(): CancellablePromise<void> {\n // Don't load suites if there isn't a local environment, or if we're\n // in serveOnly mode\n if (\n !this.config.environments.some(isLocalEnvironment) ||\n this.config.serveOnly\n ) {\n return Task.resolve();\n }\n\n if (this.hasCoveredFiles) {\n this._setInstrumentationHooks();\n }\n\n return super._loadSuites();\n }\n\n protected _resolveConfig() {\n return super._resolveConfig().then(() => {\n const config = this.config;\n\n if (config.environments.length === 0) {\n this.log(\"Adding default 'node' environment\");\n config.environments.push({ browserName: 'node' });\n }\n\n // Normalize browser names\n config.environments.forEach((env) => {\n const { browserName } = env;\n const newName = getNormalizedBrowserName(browserName)!;\n env.browserName = newName;\n if (env.browser) {\n env.browser = newName;\n }\n });\n\n // Normalize tunnel driver names\n if (config.tunnelOptions.drivers) {\n config.tunnelOptions.drivers = config.tunnelOptions.drivers.map(\n (driver) => {\n let driverName: string | undefined;\n\n if (typeof driver === 'string') {\n driverName = driver;\n } else if ('name' in driver) {\n driverName = driver.name;\n }\n\n const newName = getNormalizedBrowserName(driverName);\n\n if (typeof driver === 'string') {\n return newName! as DriverDescriptor;\n }\n\n if ('name' in driver) {\n return {\n ...driver,\n name: newName!,\n };\n }\n\n return driver;\n }\n );\n }\n\n if (!config.internPath) {\n config.internPath = dirname(dirname(__dirname));\n\n // If internPath isn't under cwd, intern is most likely\n // symlinked into the project's node_modules. In that case, use\n // the package location as resolved from the project root.\n if (config.internPath.indexOf(process.cwd()) !== 0) {\n // nodeResolve will resolve to index.js; we want the base\n // intern directory\n config.internPath = dirname(\n nodeResolve('intern', {\n basedir: process.cwd(),\n })\n );\n }\n }\n\n (['basePath', 'internPath'] as ('basePath' | 'internPath')[]).forEach(\n (property) => {\n config[property] = normalizePathEnding(\n resolve(config[property]),\n sep\n );\n }\n );\n\n if (config.benchmarkConfig) {\n config.reporters.push({\n name: 'benchmark',\n options: config.benchmarkConfig,\n });\n }\n\n this._instrumentBasePath = config.basePath;\n\n if (config.coverage) {\n // Coverage file entries should be absolute paths\n this._coverageFiles = expandFiles(config.coverage).map((path) =>\n resolve(path)\n );\n }\n\n if (!config.serverUrl) {\n config.serverUrl = `http://localhost:${config.serverPort}/`;\n }\n\n if (config.connectTimeout == null) {\n config.connectTimeout = 30000;\n }\n\n if (config.heartbeatInterval == null) {\n const idleTimeout = config.capabilities['idle-timeout'];\n config.heartbeatInterval = idleTimeout == null ? 60 : idleTimeout;\n }\n\n // Ensure URLs end with a '/'\n (\n ['serverUrl', 'functionalBaseUrl'] as (\n | 'serverUrl'\n | 'functionalBaseUrl'\n )[]\n ).forEach((property) => {\n if (config[property]) {\n config[property] = config[property]!.replace(/\\/*$/, '/');\n }\n });\n\n // Set a default name for a WebDriver session\n if (!config.capabilities.name) {\n config.capabilities.name = 'intern';\n }\n\n // idle-timeout isn't universally supported, but keep setting it by\n // default\n if (config.capabilities['idle-timeout'] == null) {\n config.capabilities['idle-timeout'] = config.heartbeatInterval;\n }\n\n const buildId = process.env.TRAVIS_COMMIT || process.env.BUILD_TAG;\n if (buildId) {\n config.capabilities.build = buildId;\n }\n\n // Expand suite globs\n config.functionalSuites = expandFiles(config.functionalSuites);\n\n // Expand suite globs into the node and browser objects\n config.node.suites = expandFiles([\n ...config.suites,\n ...config.node.suites,\n ]);\n config.browser.suites = expandFiles([\n ...config.suites,\n ...config.browser.suites,\n ]);\n\n // Clear out the suites list after combining the suites\n // @ts-ignore\n delete config.suites;\n\n if (!require.extensions['.ts']) {\n if (\n ((config.node &&\n config.node.suites.some((pattern) => pattern.endsWith('.ts'))) ||\n (config.plugins &&\n config.plugins.some((plugin) =>\n plugin.script.endsWith('.ts')\n ))) &&\n typeof this.config.node.tsconfig === 'undefined'\n ) {\n register();\n } else if (this.config.node.tsconfig) {\n register({ project: this.config.node.tsconfig });\n }\n }\n\n // Install the instrumenter in resolve config so it will be able to\n // handle suites\n this._instrumenter = createInstrumenter(\n Object.assign(\n {\n esModules: true,\n coverageVariable: config.coverageVariable,\n ...config.instrumenterOptions,\n },\n {\n preserveComments: true,\n produceSourceMap: true,\n }\n )\n );\n\n // If we're using the Selenium tunnel and the user hasn't specified any\n // drivers, try to figure out what they might need.\n if (config.tunnel === 'selenium') {\n const driverNames = this._getSeleniumDriverNames();\n\n const { tunnelOptions } = config;\n if (tunnelOptions.drivers) {\n // Remove all the driver names from driverNames that are already\n // specified in tunnelOptions.drivers\n tunnelOptions.drivers\n .map((driver) => {\n if (typeof driver === 'string') {\n return driver;\n }\n return (driver as any).name;\n })\n .filter((name) => name)\n .forEach((name) => {\n const index = driverNames.indexOf(name);\n if (index !== -1) {\n driverNames.splice(index, 1);\n }\n });\n // Mix the required driverNames into the drivers already in the config\n tunnelOptions.drivers = [\n ...tunnelOptions.drivers,\n ...driverNames.map((name) => ({ name })),\n ];\n } else {\n tunnelOptions.drivers = driverNames.map((name) => ({ name }));\n }\n }\n\n // If there are remote environments, resolve them using environments\n // available through the tunnel specified in the config.\n const remoteEnvironments =\n config.environments.filter(isRemoteEnvironment);\n if (remoteEnvironments.length > 0 && config.tunnel && !config.serveOnly) {\n const tunnel = this._createTunnel();\n\n // Add any extra capabilites provided by the tunnel to the config's\n // capabilities\n config.capabilities = deepMixin(\n tunnel.extraCapabilities,\n config.capabilities\n );\n\n return tunnel.getEnvironments().then((tunnelEnvironments) => {\n // Resolve the environments, matching versions, platforms, and browser\n // names from the config with whats available from the tunnel\n // enviroment.\n const resolvedEnvironments = resolveEnvironments(\n config.capabilities,\n remoteEnvironments,\n tunnelEnvironments\n );\n\n const localEnvironments = config.environments.filter(\n (env) => !isRemoteEnvironment(env)\n );\n\n // The full environments list is all the local environments (generally\n // just node) with all the remote environments.\n config.environments = [...localEnvironments, ...resolvedEnvironments];\n });\n }\n });\n }\n\n /**\n * Return the names of all the selenium drivers that should be needed based\n * on the environments specified in the config.\n */\n protected _getSeleniumDriverNames(): string[] {\n const { config } = this;\n const driverNames = new Set<string>();\n\n for (const env of config.environments) {\n const { browserName } = env;\n if (\n browserName === 'chrome' ||\n browserName === 'firefox' ||\n browserName === 'internet explorer'\n ) {\n driverNames.add(browserName);\n } else if (browserName === 'MicrosoftEdge') {\n const { browserVersion } = env;\n if (\n (!isNaN(browserVersion) && Number(browserVersion) < 1000) ||\n // 'insider preview' may be used to specify Edge Chromium before it is\n // official released\n (isNaN(browserVersion) && browserVersion === 'insider preview')\n ) {\n driverNames.add('MicrosoftEdgeChromium');\n } else {\n driverNames.add('MicrosoftEdge');\n }\n }\n }\n\n return Array.from<string>(driverNames);\n }\n\n protected _runTests(): CancellablePromise<void> {\n let testTask: CancellablePromise<void>;\n\n return new Task<void>(\n (resolve, reject) => {\n if (this._rootSuite.tests.length > 0) {\n testTask = this._rootSuite.run();\n } else {\n testTask = Task.resolve();\n }\n\n testTask\n .then(() => {\n if (!this._sessionSuites) {\n return;\n }\n return this._loadFunctionalSuites().then(\n () => (testTask = this._runRemoteTests())\n );\n })\n .then(resolve, reject);\n },\n () => {\n if (testTask) {\n testTask.cancel();\n }\n }\n ).finally(() => {\n // For all files that are marked for coverage that weren't read,\n // read the file and instrument the code (adding it to the overall\n // coverage map)\n const coveredFiles = this._coverageMap.files();\n const uncoveredFiles = this._coverageFiles.filter((filename) => {\n return coveredFiles.indexOf(filename) === -1;\n });\n uncoveredFiles.forEach((filename) => {\n try {\n const code = readFileSync(filename, { encoding: 'utf8' });\n this.instrumentCode(\n code,\n filename,\n filename.endsWith('.ts') || filename.endsWith('.tsx')\n );\n } catch (_error) {}\n });\n });\n }\n\n protected _runRemoteTests(): CancellablePromise<void> {\n const config = this.config;\n const sessionSuites = this._sessionSuites!;\n const queue = new FunctionQueue(config.maxConcurrency || Infinity);\n\n this.log(\n 'Running',\n sessionSuites.length,\n 'suites with maxConcurrency',\n config.maxConcurrency\n );\n\n const runTask = new Task(\n (resolve, reject) => {\n Task.all(\n sessionSuites.map((suite) => {\n this.log('Queueing suite', suite.name);\n return queue.enqueue(() => {\n this.log('Running suite', suite.name);\n return suite.run();\n });\n })\n ).then(resolve, reject);\n },\n () => {\n this.log('Canceling remote tests');\n queue.clear();\n }\n );\n\n return runTask\n .then(() => {})\n .finally(() => {\n if (config.functionalCoverage !== false) {\n // Collect any local coverage generated by functional tests\n this.log('Emitting functional coverage');\n return this._emitCoverage('functional tests');\n }\n });\n }\n\n /**\n * Adds hooks for code coverage instrumentation in the Node.js loader.\n */\n protected _setInstrumentationHooks() {\n hookRunInThisContext(\n (filename) => this.shouldInstrumentFile(filename),\n (code, { filename }) => this.instrumentCode(code, filename)\n );\n this._unhookRequire = hookRequire(\n (filename) => this.shouldInstrumentFile(filename),\n (code, { filename }) => this.instrumentCode(code, filename),\n { extensions: ['.js', '.jsx', '.ts', 'tsx'] }\n );\n }\n\n /**\n * Removes instrumentation hooks\n */\n protected _removeInstrumentationHooks() {\n unhookRunInThisContext();\n if (this._unhookRequire) {\n this._unhookRequire();\n this._unhookRequire = undefined;\n }\n }\n}\n\nexport { Config, EnvironmentSpec };\n\nexport interface NodePlugins extends Plugins {\n tunnel: typeof Tunnel;\n}\n\nexport interface Remote extends Command<any> {\n environmentType?: Environment;\n requestedEnvironment?: Environment;\n setHeartbeatInterval(delay: number): Command<any>;\n}\n\nexport interface TunnelMessage {\n tunnel: Tunnel;\n progress?: DownloadProgressEvent;\n status?: string;\n}\n\nexport interface NodeEvents extends Events {\n /** A test server has stopped */\n serverEnd: Server;\n\n /** A test server was started */\n serverStart: Server;\n\n /** Emitted as a Tunnel executable download is in process */\n tunnelDownloadProgress: TunnelMessage;\n\n /** A WebDriver tunnel has been opened */\n tunnelStart: TunnelMessage;\n\n /** A status update from a WebDriver tunnel */\n tunnelStatus: TunnelMessage;\n\n /** A WebDriver tunnel has been stopped */\n tunnelStop: TunnelMessage;\n}\n\n/**\n * A basic FIFO function queue to limit the number of currently executing\n * asynchronous functions.\n */\nclass FunctionQueue {\n readonly maxConcurrency: number;\n queue: QueueEntry[];\n activeTasks: CancellablePromise<any>[];\n funcTasks: CancellablePromise<any>[];\n\n constructor(maxConcurrency: number) {\n this.maxConcurrency = maxConcurrency;\n this.queue = [];\n this.activeTasks = [];\n this.funcTasks = [];\n }\n\n enqueue(func: () => CancellablePromise<any>) {\n const funcTask = new Task((resolve, reject) => {\n this.queue.push({ func, resolve, reject });\n });\n this.funcTasks.push(funcTask);\n\n if (this.activeTasks.length < this.maxConcurrency) {\n this.next();\n }\n\n return funcTask;\n }\n\n clear() {\n this.activeTasks.forEach((task) => task.cancel());\n this.funcTasks.forEach((task) => task.cancel());\n this.activeTasks = [];\n this.funcTasks = [];\n this.queue = [];\n }\n\n next() {\n if (this.queue.length > 0) {\n const { func, resolve, reject } = this.queue.shift()!;\n const task = func()\n .then(resolve, reject)\n .finally(() => {\n // Remove the task from the active task list and kick off\n // the next task\n pullFromArray(this.activeTasks, task);\n this.next();\n });\n this.activeTasks.push(task);\n }\n }\n}\n\ninterface QueueEntry {\n func: () => CancellablePromise<any>;\n resolve: () => void;\n reject: () => void;\n}\n\nfunction isRemoteEnvironment(environment: EnvironmentSpec) {\n return environment.browserName !== 'node';\n}\n\nfunction isLocalEnvironment(environment: EnvironmentSpec) {\n return !isRemoteEnvironment(environment);\n}\n\nfunction getNormalizedBrowserName(name: string | undefined) {\n if (name === 'ie') {\n return 'internet explorer';\n }\n if (name && /^edge/.test(name)) {\n return name.replace(/^edge/, 'MicrosoftEdge');\n }\n return name;\n}\n"]} |