# `Expresso.Check.Tools`
[🔗](https://github.com/rellen/expresso/blob/main/lib/expresso/check/tools.ex#L1)

Installs the tools of the browser levels of `--check` into a directory of the user

`mix expresso --install-check-tools` and `expresso --install-check-tools`
call `install/2`. The function installs the npm packages `playwright` and
`axe-core` into `directory/1`, and the Chromium and the headless shell of
Playwright into the cache of Playwright. The check then finds each tool
there, so a project with no `node_modules` can run each level. The
installation needs Node and npm on the `PATH`.

`--check=browser` in a Mix project also needs the Hex package
`playwright_ex` in the deps of the project. The binary holds it.

# `directory`

```elixir
@spec directory(%{required(String.t()) =&gt; String.t()}) :: Path.t()
```

Return the directory of the tools

The variable `EXPRESSO_TOOLS` in `env` gives the directory. Without it, the
directory is `expresso` in the cache directory of the user, such as
`~/.cache/expresso` on Linux and `~/Library/Caches/expresso` on macOS.

# `install`

```elixir
@spec install(%{required(String.t()) =&gt; String.t()}, (String.t(), [String.t()] -&gt;
                                                  non_neg_integer())) ::
  :ok | {:error, String.t()}
```

Install the tools, write the progress, and return `:ok` or an error

The function runs these commands, in sequence:

1. `npm install --prefix <directory> playwright axe-core`, with the
   versions of `packages/0`.
2. `node <directory>/node_modules/playwright/cli.js install chromium`,
   which installs the Chromium and the headless shell of Playwright.

`run` runs one command with its arguments, and returns its exit status.
The default writes the output of the command to the standard output.

# `packages`

```elixir
@spec packages() :: [String.t()]
```

Return the npm packages that `install/2` installs, with their versions

Each version is the version of the package in `package.json`, so the list
has the form `["playwright@<version>", "axe-core@<version>"]`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
