Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MochaTarget

Represents a test build using Mocha, it runs with Node.

Hierarchy

Index

Properties

Optional afterBuild

afterBuild: TaskFunction

External task to run after {target}:build

Optional buildDir

buildDir: RelPosixPath

Relative path to the build directory for this target, relative to project.rootDir. The default value is join(project.buildDir, target.name).

Optional clean

Minimatch patterns to clean the files created during the build and dist tasks, relative to project.root.

Default: { dirs: [ path.join(project.buildDir, target.targetDir), path.join(project.distDir, target.targetDir) ] }

Optional copy

copy: CopyOptions[]

A list of copy operations to perform during the build process.

Default: []

Optional dependencies

dependencies: BaseDependencies

Override default dependencies or provide optional dependencies.

Optional generateTestMain

generateTestMain: undefined | false | true

Controls the Mocha entry points.

The default value is true.

  • If false, the glob patterns for the entry points are passed to mocha directly.

  • If true, an the files are globbed at build time to generate an entry point.

    • If .mjs files are emitted, a test.esm.js is generated. It contains an async IIFE. Each test file is mapped to await import(/* file *\/);.
    • If *.js files are emitted, a test.cjs.js is generated. It contains an IIFE. Each test file is mapped to require(/* file *\/);.
  • If .mjs files are emitted, use *.spec.mjs

  • If .js files are emitted, use *.spec.js

  • If both .js & .mjs files are emitted, TODO: explanation (default to mjs but add task to run cjs manually)

name

name: string

Name of the target. All the tasks related to this target will be prefixed by this name. It will also be used to resolve the default values for some paths, so it must avoid any special characters.

project

project: Project

Optional scripts

scripts: Iterable<string>

Glob patterns for the Typescript sources, relative to target.srcDir.

It uses the minimatch patterns. Glob stars (wild stars, **) use target.srcDir as their base directory.

Default: [join(target.srcDir, "**", "*.ts")]

Optional srcDir

srcDir: RelPosixPath

Relative path to the base directory for the sources, relative to project.rootDir. The default value is project.srcDir.

Optional testReporter

testReporter: MochaReporter

Mocha test reporter to use.

Default: "spec"

Optional tscOptions

tscOptions: CustomTscOptions

Overrides for the options of the Typescript compiler.

Optional tsconfigJson

tsconfigJson: RelPosixPath

Path to the tsconfig.json file for this target, relative to project.rootDir.

The default value is join(target.srcDir, "tsconfig.json").

Generated using TypeDoc