@wdio/config
Advanced tools
Comparing version 9.0.0-alpha.115 to 9.0.0-alpha.321
import type { Options, Services } from '@wdio/types'; | ||
export declare const DEFAULT_CONFIGS: () => Omit<Options.Testrunner, 'capabilities'>; | ||
export declare const DEFAULT_CONFIGS: () => Options.Testrunner; | ||
export declare const SUPPORTED_HOOKS: (keyof Services.Hooks)[]; | ||
@@ -4,0 +4,0 @@ export declare const SUPPORTED_FILE_EXTENSIONS: string[]; |
@@ -37,9 +37,2 @@ const DEFAULT_TIMEOUT = 10000; | ||
cucumberFeaturesWithLineNumbers: [], | ||
autoCompileOpts: { | ||
autoCompile: true, | ||
tsNodeOpts: { | ||
transpileOnly: true | ||
}, | ||
babelOpts: {} | ||
}, | ||
/** | ||
@@ -46,0 +39,0 @@ * framework defaults |
import type { Capabilities, Options, Services } from '@wdio/types'; | ||
import type { PathService, ModuleImportService } from '../types.js'; | ||
import type { PathService } from '../types.js'; | ||
type Spec = string | string[]; | ||
interface TestrunnerOptionsWithParameters extends Omit<Options.Testrunner, 'capabilities'> { | ||
interface TestrunnerOptionsWithParameters extends Options.Testrunner { | ||
watch?: boolean; | ||
@@ -10,4 +10,5 @@ coverage?: boolean; | ||
repeat?: number; | ||
capabilities?: Capabilities.RemoteCapabilities; | ||
capabilities?: Capabilities.TestrunnerCapabilities; | ||
rootDir: string; | ||
tsConfigPath?: string; | ||
} | ||
@@ -28,5 +29,4 @@ interface MergeConfig extends Omit<Partial<TestrunnerOptionsWithParameters>, 'specs' | 'exclude'> { | ||
private _pathService; | ||
private _moduleRequireService; | ||
private _config; | ||
private _capabilities; | ||
private _capabilities?; | ||
constructor(configFilePath: string, | ||
@@ -37,3 +37,3 @@ /** | ||
*/ | ||
_initialConfig?: Partial<TestrunnerOptionsWithParameters>, _pathService?: PathService, _moduleRequireService?: ModuleImportService); | ||
_initialConfig?: Partial<TestrunnerOptionsWithParameters>, _pathService?: PathService); | ||
/** | ||
@@ -81,3 +81,3 @@ * initializes the config object | ||
*/ | ||
getCapabilities(i?: number): Capabilities.DesiredCapabilities | Capabilities.W3CCapabilities | Capabilities.RemoteCapabilities; | ||
getCapabilities(i?: number): Capabilities.TestrunnerCapabilities | Capabilities.RequestedStandaloneCapabilities | undefined; | ||
/** | ||
@@ -84,0 +84,0 @@ * returns a flattened list of globbed files |
import path from 'node:path'; | ||
import logger from '@wdio/logger'; | ||
import { deepmerge, deepmergeCustom } from 'deepmerge-ts'; | ||
import RequireLibrary from './RequireLibrary.js'; | ||
import FileSystemPathService from './FileSystemPathService.js'; | ||
import { makeRelativeToCWD, loadAutoCompilers } from './utils.js'; | ||
import { makeRelativeToCWD, loadTypeScriptCompiler } from './utils.js'; | ||
import { removeLineNumbers, isCucumberFeatureWithLineNumber, validObjectOrArray } from '../utils.js'; | ||
@@ -14,3 +13,2 @@ import { SUPPORTED_HOOKS, SUPPORTED_FILE_EXTENSIONS, DEFAULT_CONFIGS, NO_NAMED_CONFIG_EXPORT } from '../constants.js'; | ||
_pathService; | ||
_moduleRequireService; | ||
#isInitialised = false; | ||
@@ -25,6 +23,5 @@ #configFilePath; | ||
*/ | ||
_initialConfig = {}, _pathService = new FileSystemPathService(), _moduleRequireService = new RequireLibrary()) { | ||
_initialConfig = {}, _pathService = new FileSystemPathService()) { | ||
this._initialConfig = _initialConfig; | ||
this._pathService = _pathService; | ||
this._moduleRequireService = _moduleRequireService; | ||
this.#configFilePath = configFilePath; | ||
@@ -39,10 +36,2 @@ this._config = Object.assign({ rootDir: path.dirname(configFilePath) }, DEFAULT_CONFIGS()); | ||
} | ||
/** | ||
* the autoCompileOpts.autoCompile CLI argument has to be converted | ||
* from type string to type boolean | ||
*/ | ||
if (typeof _initialConfig.autoCompileOpts?.autoCompile === 'string') { | ||
const strValue = _initialConfig.autoCompileOpts.autoCompile; | ||
_initialConfig.autoCompileOpts.autoCompile = !!strValue && strValue !== 'false'; | ||
} | ||
this.merge(_initialConfig, false); | ||
@@ -59,3 +48,3 @@ } | ||
if (!this.#isInitialised) { | ||
await loadAutoCompilers(this._config.autoCompileOpts, this._moduleRequireService); | ||
await loadTypeScriptCompiler(this._config.tsConfigPath); | ||
await this.addConfigFile(this.#configFilePath); | ||
@@ -104,2 +93,6 @@ } | ||
} | ||
const configFileCapabilities = config.capabilities; | ||
if (!configFileCapabilities) { | ||
throw new Error(`No \`capabilities\` property found in WebdriverIO.Config defined in file: ${filePath}`); | ||
} | ||
/** | ||
@@ -112,3 +105,3 @@ * clone the original config | ||
*/ | ||
const defaultTo = Array.isArray(this._capabilities) ? [] : {}; | ||
const defaultTo = (Array.isArray(this._capabilities) ? [] : {}); | ||
this._capabilities = deepmerge(this._capabilities, fileConfig.capabilities || defaultTo); | ||
@@ -115,0 +108,0 @@ delete fileConfig.capabilities; |
@@ -1,7 +0,3 @@ | ||
import type { Options } from '@wdio/types'; | ||
import type { ModuleImportService } from '../types.js'; | ||
export declare function loadTypeScriptCompiler(autoCompileConfig: Options.AutoCompileConfig): Promise<boolean>; | ||
export declare function loadTypeScriptCompiler(tsConfigPath?: string): Promise<boolean>; | ||
export declare function makeRelativeToCWD(files?: (string | string[])[]): (string | string[])[]; | ||
export declare function loadAutoCompilers(autoCompileConfig: Options.AutoCompileConfig, requireService: ModuleImportService): Promise<boolean | undefined>; | ||
export declare function loadBabelCompiler(babelOpts: Record<string, any> | undefined, requireService: ModuleImportService): Promise<boolean>; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -8,3 +8,3 @@ import url from 'node:url'; | ||
const log = logger('@wdio/config:utils'); | ||
export async function loadTypeScriptCompiler(autoCompileConfig) { | ||
export async function loadTypeScriptCompiler(tsConfigPath) { | ||
/** | ||
@@ -20,14 +20,13 @@ * don't auto compile within worker as it already was spawn with a loader | ||
*/ | ||
if (process.env.VITEST_WORKER_ID && process.env.THROW_TSNODE_RESOLVE) { | ||
if (process.env.VITEST_WORKER_ID && process.env.THROW_TSX_RESOLVE) { | ||
throw new Error('test fail'); | ||
} | ||
await resolve('ts-node', import.meta.url); | ||
const loaderPath = await resolve('ts-node/esm/transpile-only.mjs', import.meta.url); | ||
const loaderPath = await resolve('tsx', import.meta.url); | ||
await access(new URL(loaderPath)); | ||
process.env.WDIO_LOAD_TS_NODE = '1'; | ||
objectToEnv(autoCompileConfig.tsNodeOpts); | ||
process.env.WDIO_LOAD_TSX = '1'; | ||
objectToEnv({ tsConfigPath }); | ||
return true; | ||
} | ||
catch (err) { | ||
log.debug(`Failed loading TS Node: ${err.message}`); | ||
log.debug(`Failed loading TSX: ${err.message}`); | ||
return false; | ||
@@ -51,24 +50,1 @@ } | ||
} | ||
export async function loadAutoCompilers(autoCompileConfig, requireService) { | ||
if (!autoCompileConfig.autoCompile) { | ||
return; | ||
} | ||
return (await loadTypeScriptCompiler(autoCompileConfig) || | ||
await loadBabelCompiler(autoCompileConfig.babelOpts, requireService)); | ||
} | ||
export async function loadBabelCompiler(babelOpts = {}, requireService) { | ||
try { | ||
/** | ||
* only for testing purposes | ||
*/ | ||
if (process.env.VITEST_WORKER_ID && process.env.THROW_BABEL_REGISTER) { | ||
throw new Error('test fail'); | ||
} | ||
(await requireService.import('@babel/register'))(babelOpts); | ||
log.debug('Found \'@babel/register\' package, auto-compiling files with Babel'); | ||
return true; | ||
} | ||
catch (err) { | ||
return false; | ||
} | ||
} |
{ | ||
"name": "@wdio/config", | ||
"version": "9.0.0-alpha.115+8196c4ccb", | ||
"version": "9.0.0-alpha.321+63953a607", | ||
"description": "A helper utility to parse and validate WebdriverIO options", | ||
@@ -39,7 +39,7 @@ "author": "Christian Bromann <mail@bromann.dev>", | ||
"dependencies": { | ||
"@wdio/logger": "9.0.0-alpha.115+8196c4ccb", | ||
"@wdio/types": "9.0.0-alpha.115+8196c4ccb", | ||
"@wdio/utils": "9.0.0-alpha.115+8196c4ccb", | ||
"@wdio/logger": "9.0.0-alpha.321+63953a607", | ||
"@wdio/types": "9.0.0-alpha.321+63953a607", | ||
"@wdio/utils": "9.0.0-alpha.321+63953a607", | ||
"decamelize": "^6.0.0", | ||
"deepmerge-ts": "^5.0.0", | ||
"deepmerge-ts": "^7.0.3", | ||
"glob": "^10.2.2", | ||
@@ -54,3 +54,3 @@ "import-meta-resolve": "^4.0.0" | ||
}, | ||
"gitHead": "8196c4ccb4f66e217e161804ef549f18b60dccb3" | ||
"gitHead": "63953a6079023cb390a113fe5ce1c1b01b8e4bb6" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
9
46261
951
+ Addeddeepmerge-ts@7.1.0(transitive)
- Removeddeepmerge-ts@5.1.0(transitive)
Updateddeepmerge-ts@^7.0.3