Skip to content

Test executor

The test executor runs Go tests using go test ./....

nx test my-go-project
Option Type Default Description
cover boolean false Enable coverage analysis
coverProfile string - Write a coverage profile to the file after all tests have passed
race boolean false Enable race detector
run string - Run only tests matching this regular expression
verbose boolean false Enable verbose test output
count number - Run test N times
timeout string 10m If a test binary runs longer than duration d, panic. If d is 0, the timeout is disabled. The default is 10 minutes (10m).

Inferred for all Go projects (applications and libraries):

{
  "executor": "@naxodev/gonx:test",
  "cache": true,
  "dependsOn": ["generate", "^build"],
  "inputs": [
    "{projectRoot}/go.mod",
    "{projectRoot}/go.sum",
    "{projectRoot}/**/*.{go}"
  ]
}

The ^build dependency means test targets run after upstream project build targets complete.