Nx plugin to infer Web Test Runner in a workspace.
Note that @web/test-runner
has not released a 1.0.0
yet.
npm i -D @robby-rabbitman/nx-plus-web-test-runner
nx g @robby-rabbitman/nx-plus-web-test-runner:init
Projects with a Web Test Runner now have a test target.
nx run {{project}}:test
Adds @robby-rabbitman/nx-plus-web-test-runner/plugin
to the plugins
in the nx.json
.
nx g @robby-rabbitman/nx-plus-web-test-runner:init
Option | Type | Default | Description |
---|---|---|---|
test-target-name | string | 'test' | The name of the Web Test Runner target. |
skip-format | boolean | false | Whether to skip formatting the updated files. |
skip-add-plugin | boolean | false | Whether to skip adding the plugin. |
Adds a test target for projects that have a Web Test Runner config file in their root, the plugin infers a Web Test Runner with one of the following names.
web-test-runner.config.js
web-test-runner.config.cjs
web-test-runner.config.mjs
wtr.config.js
wtr.config.cjs
wtr.config.mjs
// nx.json
"plugins": [
{
"plugin": "@robby-rabbitman/nx-plus-web-test-runner/plugin",
"options": {
// the name of the web test runner target => nx run {{project}}:test
"testTargetName": "test",
// the default configuration of the web test runner targets inferred by this plugin
"testTargetConfig": {
"options":{
"node-resolve": true
}
}
}
},
]
testTargetConfig
is different from targetDefaults since it applies only to the inferred targets and not every target.