lukeed / lukeed/uvu

API for grouping tests, a la `describe`

Open
#43 22 comments 22 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3k
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Something I often do when using Mocha:

```js
describe('my-library', () => {
describe('method_one', () => {
it('returns a string', () => {
assert.equal(typeof my_library.method_one(), 'string');
});

// ...
});

describe('method_two', () => {
it('returns a number', () => {
assert.equal(typeof my_library.method_two(), 'number');
});

// ...
});
});
```

This results in neatly indented output...

```
my-library
method_one
✓ returns a string
✓ ...
method_two
✓ returns a number
✓ ...
```

...and makes it easier to identify (and isolate/skip) problematic groups of tests.

It'd be nice to have something equivalent in uvu — perhaps something like this?

```js
test.group('my-library', () => {
test.group('method_one', () => {
test('returns a string', () => {
assert.equal(typeof my_library.method_one(), 'string');
});

// ...
});

test.group('method_two', () => {
test('returns a number', () => {
assert.equal(typeof my_library.method_two(), 'number');
});

// ...
});
});
```

Plus `test.group.only` etc. Thoughts?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the issue's nested test.group examples and the described indented output; the payload names no files or tests. Define how nested groups and test.group.only-style isolation should behave, then verify grouped tests render hierarchically and can be isolated or skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.