Migrate test suite from mocha + chai to ava#171
Merged
Conversation
Sitespeed.io and browsertime have standardised on ava for testing, so
coach-core was the odd one out — mocha as runner, chai for assertions,
and chai-as-promised purely for two should.eventually callers. Moving
to ava drops three devDependencies in one swoop and gives anyone
hopping between the three repos a single testing model.
All 45 test files were converted: the nested describe/it structure is
flattened into ava's flat test('Suite / Case', t => ...) form so the
old suite grouping stays visible in the test names; chai's should and
expect assertions are mapped onto the corresponding t.is,
t.deepEqual, t.truthy, t.regex, t.true / t.false. Browser-
driven tests keep their per-browser runner setup, but as a single
module-level Map populated in test.before and torn down in
test.after.always, with test.serial + t.timeout(60_000) per
case.
One file rename came along for the ride: test/har/performance/
mimeTypes.js → mimeTypesTest.js, so it matches the *Test.js convention
every other file already followed. Mocha's recursive scan was happy to
pick it up under the old name; ava's glob is stricter.
Co-authored-by: Claude noreply@anthropic.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sitespeed.io and browsertime have standardised on ava for testing, so
coach-core was the odd one out — mocha as runner, chai for assertions,
and chai-as-promised purely for two should.eventually callers. Moving
to ava drops three devDependencies in one swoop and gives anyone
hopping between the three repos a single testing model.
All 45 test files were converted: the nested describe/it structure is
flattened into ava's flat test('Suite / Case', t => ...) form so the
old suite grouping stays visible in the test names; chai's should and
expect assertions are mapped onto the corresponding t.is,
t.deepEqual, t.truthy, t.regex, t.true / t.false. Browser-
driven tests keep their per-browser runner setup, but as a single
module-level Map populated in test.before and torn down in
test.after.always, with test.serial + t.timeout(60_000) per
case.
One file rename came along for the ride: test/har/performance/
mimeTypes.js → mimeTypesTest.js, so it matches the *Test.js convention
every other file already followed. Mocha's recursive scan was happy to
pick it up under the old name; ava's glob is stricter.
Co-authored-by: Claude noreply@anthropic.com