eslint-plugin-detox-bcp

1.0.2 • Public • Published

eslint-plugin-detox-bcp

Contains ESLint rules that may enforce current best practices for Detox.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-detox-bcp:

npm install eslint-plugin-detox-bcp --save-dev

Usage

Add detox to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "detox-bcp"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "detox-bcp/no-unhandled-catch": "error"
    }
}

or just use:

{
    "extends": [
        "plugin:detox-bcp/all"
    ]
}

Supported Rules

detox-bcp/no-unhandled-catch

Prevents situations where the test writer always treats a caught error as a failed expectation or element action:

try {
  await myTestDriver.tapOnNewButton();
} catch (e) {
  // what if `e` is a SyntaxError or anything else?
  await myTestDriver.tapOnOldButton();
}

The rule enforces handling of the caught errors, e.g.:

try {
  await myTestDriver.tapOnNewButton();
} catch (e) {
  if (!`${e}`.match(/^DetoxRuntimeError.*visible/)) {
    throw e;
  }

  await myTestDriver.tapOnOldButton();
}

Package Sidebar

Install

npm i eslint-plugin-detox-bcp

Weekly Downloads

25

Version

1.0.2

License

MIT

Unpacked Size

15.2 kB

Total Files

6

Last publish

Collaborators

  • yaroslavs