gohypergiant / standard-toolkit

The web "standard library" for the Accelint family of systems.
Apache License 2.0
1 stars 0 forks source link

TODO: vitest conventions #11

Open brandonjpierce opened 4 months ago

brandonjpierce commented 4 months ago

A common pattern we have is doing something like:

const pairs = [
  ['test title', 123],
  ['test title', 123],
  ['test title', 123],
  ['test title', 123],
]

it('the test', () => {
  for (const pair of pairs) {
    expect(pair[1]).toEqual(123);
  } 
});

However, vitest does have it.each which works on pairs like datasets. Should we switch to that method instead?

brandonjpierce commented 4 months ago

Perhaps move this to a discussion instead

belsrc commented 3 months ago

It also has ... which is what I prefer to use.

describe('description...', () => {
  for (const [a, b] of TESTS) {
    it.concurrent( ... )
  }
}

https://vitest.dev/api/#test-concurrent

Additionally, can mark the entire inner describe as well. https://vitest.dev/api/#describe-concurrent