-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: start replacing jest with mocha, starting with unit-cli #13568
Changes from all commits
e15d486
b57b6d6
5f1f6be
2bd3231
f92351a
e10c0ac
2f7f891
c4d591b
d4d4830
5b2b8b0
5b03510
b553be9
e7eb722
8f8eaea
b084502
939e1d0
dbb8e60
2b3e56b
4f96ce4
d00d94a
071ae8e
b311566
71198a5
0cebb33
7f0a250
1092625
9bea135
7e3912d
e4d3a62
b3c9ecf
39eef45
4cff085
8eedc78
6656a0b
74336c5
c8c69a0
b497806
8ab1d52
bc1c959
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,7 @@ | |
import {strict as assert} from 'assert'; | ||
import fs from 'fs'; | ||
|
||
import yargs from 'yargs'; | ||
|
||
import {getFlags} from '../../cli-flags.js'; | ||
import {getFlags, getYargsParser} from '../../cli-flags.js'; | ||
import {LH_ROOT} from '../../../root.js'; | ||
|
||
/** | ||
|
@@ -37,18 +35,17 @@ function snapshot(flags) { | |
|
||
describe('CLI flags', function() { | ||
it('all options should have descriptions', () => { | ||
getFlags('chrome://version'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with jest But, that property is only added to the module object in jest because ... reasons? The modules aren't really es modules, I guess, and es module objects are read-only, IIRC. Anyhow, the |
||
|
||
const parser = getYargsParser(); | ||
// @ts-expect-error - getGroups is private | ||
const optionGroups = yargs.getGroups(); | ||
const optionGroups = parser.getGroups(); | ||
/** @type {string[]} */ | ||
const allOptions = []; | ||
Object.keys(optionGroups).forEach(key => { | ||
allOptions.push(...optionGroups[key]); | ||
}); | ||
const optionsWithDescriptions = | ||
// @ts-expect-error - getUsageInstance is private | ||
Object.keys(yargs.getInternalMethods().getUsageInstance().getDescriptions()); | ||
Object.keys(parser.getInternalMethods().getUsageInstance().getDescriptions()); | ||
|
||
allOptions.forEach(opt => { | ||
assert.ok(optionsWithDescriptions.includes(opt), `cli option '${opt}' has no description`); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint-env mocha now?