Runner.compilerOptions Method

Specifies test compilation settings. The current version of TestCafe can only configure the TypeScript compiler.

async compilerOptions(options) → this

The Runner.compilerOptions method accepts all compiler options listed in the official TypeScript documentation, as well as two additional parameters:

Parameter Type Description
customCompilerModulePath String The absolute or relative path to the TypeScript compiler module.
configPath String The absolute or relative path to the TypeScript configuration file.
note

TestCafe resolves user-specified relative paths against the TestCafe installation folder.

   runner.compilerOptions({
    "typescript": {
        customCompilerModulePath: '../node_modules/typescript-v4',
        configPath: 'custom-ts-config.json',
        experimentalDecorators: true
     ...
     }});

Related configuration file property: compilerOptions
Related CLI parameter: –compiler-options