Skip to content

Support WebdriverIO v8 #398

@ghost

Description

After upgrading from WDIO v7 (7.30.2) to v8 (8.8.8) I'm getting "Launcher is not a constructor" when using this schematic.

I have the schematic configured to use a tsconfig specific to running WDIO:

{
    "compilerOptions": {
        "resolveJsonModule": true,
        "target": "ES5",
        "types": [
            "node",
            "@wdio/globals/types",
            "@wdio/mocha-framework"
        ]
    }
}

My Angular v15 (15.2.6) project is using:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "ES2022",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "ES2022",
    "lib": [
      "ES2022",
      "dom"
    ],
    "resolveJsonModule": true,
    "useDefineForClassFields": false
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

I tried to debug this using ts-node REPL from the root of the project and discovered a few things (which could indicate that I've misconfigured something, though I could still use your wisdom):

> const Launcher = require('@wdio/cli').default
undefined
> console.log(Launcher)
undefined
undefined
> const Launcher = require('@wdio/cli')
undefined
> console.log(Launcher)
{ Launcher: [class Launcher], run: [AsyncFunction: run] }
undefined
> import Launcher from '@wdio/cli'
<repl>.ts:4:8 - error TS2613: Module '"<project path>/node_modules/@wdio/cli/build/index"' has no default export. Did you mean to use 'import { Launcher } from "<project path>/node_modules/@wdio/cli/build/index"' instead?

Is it possible that @wdio/cli no longer has a default export? Which would cause an error in the following code:

const Launcher = require(path.join(process.cwd(), 'node_modules', '@wdio', 'cli')).default

const launcher: LauncherType = new Launcher(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions