Skip to content

Latest commit

 

History

History
80 lines (59 loc) · 3 KB

README.md

File metadata and controls

80 lines (59 loc) · 3 KB

NPM downloads per week NPM version Nx peer dependency version @web/test-runner peer dependency version

nx-plus-web-test-runner

Nx plugin to infer Web Test Runner in a workspace.

Note that @web/test-runner has not released a 1.0.0 yet.

🚀 Getting started

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

📖 Documentation

@robby-rabbitman/nx-plus-web-test-runner:init

Adds @robby-rabbitman/nx-plus-web-test-runner/plugin to the plugins in the nx.json.

Usage

nx g @robby-rabbitman/nx-plus-web-test-runner:init

Options

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.

@robby-rabbitman/nx-plus-web-test-runner/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

Options

// 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.