Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#9): cannot start wdio tests #28

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/builders/webdriverio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default createBuilder<JsonObject & Options>(execute);

interface Options extends RunCommandArguments {
configFile: string
tsconfigFile: string
devServerTarget: string
watch: boolean
}
Expand Down Expand Up @@ -92,6 +93,10 @@ export async function execute(

options.configFile = defaultConfigPath
}

if (options.tsconfigFile) {
options.autoCompileOpts = { tsNodeOpts: { project: options.tsconfigFile } }
}

const launcher: LauncherType = new Launcher(
options.configFile,
Expand Down
4 changes: 4 additions & 0 deletions src/builders/webdriverio/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"type": "string",
"description": "Path to WebdriverIO config file"
},
"tsconfigFile": {
"type": "string",
"description": "Path to Typescript config file"
},
"devServerTarget": {
"type": "string",
"description": "Dev server target to run tests against."
Expand Down
13 changes: 0 additions & 13 deletions src/schematics/webdriverio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,6 @@ function updateFiles(tree: Tree, context: SchematicContext, parsedAnswers: Parse
JSON.stringify(TS_CONFIG, null, 4)
)

const wdioConfigPath = path.join(process.cwd(), `wdio.conf.${parsedAnswers.isUsingTypeScript ? 'ts': 'js'}`);

const wdioConfig = fs.readFileSync(wdioConfigPath).toString()
fs.writeFileSync(wdioConfigPath, (
wdioConfig.slice(0, -4) + '\n' +
' autoCompileOpts: {\n' +
' tsNodeOpts: {\n' +
' transpileOnly: true,\n' +
' project: __dirname + \'/' + tsconfigDir + '/tsconfig.e2e.json\'\n' +
' }\n' +
' }\n' +
'}\n'
))
return tree
}
}
Expand Down