avajs / avajs/ava

`pattern` CLI option Path Expansion

Open
#3,206 3 comments 0 reactions 0 assignees View on GitHub
needs triage
Dominant language
JavaScript
Stars
20.8k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Please provide details about:

* What you're trying to do

```console
pnpm exec ava ~/code/tests
```

This results in an error: `Expected pattern to be a non-empty string`

The error is both incorrect and unfortunate. The `pattern` passed was not empty, `ava` just didn't know what to do with it.

* Why you can't use AVA for this

Oodles of tertiary tooling will provide paths with a leading tilde. However correct or incorrect that is, it would be useful for local tooling to be able to leverage a tilde as a home directory path.

* And maybe how you think AVA could handle this

Execute a `resolve` on the passed pattern if it doesn't match any of the other expected shapes, or begins with a tilde.

```
→ node
Welcome to Node.js v18.15.0.
Type ".help" for more information.
> const { resolve } = require('path')
undefined
> resolve('~')
'/Users/user/code/test/~'
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `pnpm exec ava ~/code/tests` and trace the CLI entry point that handles the `pattern` option. Check how tilde-prefixed paths are classified before the non-empty-pattern error; done means the path is accepted as a home-directory path and coverage verifies the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.