Skip to content

Commit

Permalink
Switch to allow list
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Nov 23, 2023
1 parent a5d031d commit 241b264
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions lib/core/engine/command/measure.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { timestamp as _timestamp } from '../../../support/engineUtils.js';
import { Video } from '../../../video/video.js';
import { pathToFolder } from '../../../support/pathToFolder.js';
import { setOrangeBackground } from '../../../video/screenRecording/setOrangeBackground.js';
import { filterWhitelisted } from '../../../support/userTiming.js';
import { filterAllowlisted } from '../../../support/userTiming.js';
import { isAndroidConfigured, Android } from '../../../android/index.js';
import { TCPDump } from '../../../support/tcpdump.js';
import { lcpHighlightScript as highlightLargestContentfulPaint } from './util/lcpHighlightScript.js';
Expand Down Expand Up @@ -487,11 +487,11 @@ export class Measure {

// Some sites has crazy amount of user timings:
// strip them if you want
if (this.options.userTimingWhitelist) {
filterWhitelisted(
if (this.options.userTimingAllowList) {
filterAllowlisted(
this.result[this.numberOfMeasuredPages].browserScripts.timings
.userTimings,
this.options.userTimingWhitelist
this.options.userTimingAllowList
);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/support/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ export function parseCommandLine() {
choices: ['min', 'middle', 'max'],
default: 'min',
describe:
'Using a Samsung A51 or Moto G5 you can choose how to pin the CPU to better align the speed with your users. This only works on rooted phones and together with --android.rooted',
'Using a Samsung A51 or Moto G5 you can choose how to pin the CPU to better align the speed with your users. This only works on rooted phones and together with --android.root5ed',
group: 'android'
})
.option('android.batteryTemperatureLimit', {
Expand Down Expand Up @@ -1211,9 +1211,9 @@ export function parseCommandLine() {
type: 'integer',
default: 1500
})
.option('userTimingWhitelist', {
.option('userTimingAllowList', {
describe:
'All userTimings are captured by default this option takes a regex that will whitelist which userTimings to capture in the results.'
'All userTimings are captured by default this option takes a regex that will allow which userTimings to capture in the results.'
})
.option('headless', {
type: 'boolean',
Expand Down
4 changes: 2 additions & 2 deletions lib/support/userTiming.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function filterWhitelisted(userTimings, whitelistRegex) {
const allowed = new RegExp(whitelistRegex);
export function filterAllowlisted(userTimings, allowlistRegex) {
const allowed = new RegExp(allowlistRegex);
userTimings.marks = userTimings.marks.filter(mark => allowed.test(mark.name));
userTimings.measures = userTimings.measures.filter(measure =>
allowed.test(measure.name)
Expand Down
4 changes: 2 additions & 2 deletions test/unittests/userTimingTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava';
import { resolve } from 'node:path';
import { filterWhitelisted } from '../../lib/support/userTiming.js';
import { filterAllowlisted } from '../../lib/support/userTiming.js';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
Expand All @@ -11,7 +11,7 @@ const timingsFile = resolve(__dirname, '..', 'data', 'timings.json');
test(`Filter white listed user timings`, async t => {
const userTimings = JSON.parse(readFileSync(timingsFile, 'utf8')).timings
.userTimings;
filterWhitelisted(userTimings, 'foo_');
filterAllowlisted(userTimings, 'foo_');
t.deepEqual(
JSON.stringify(userTimings.marks),
'[{"name":"foo_test","startTime":"1500.111"},{"name":"foo_test2","startTime":"1100.111"}]'
Expand Down

0 comments on commit 241b264

Please sign in to comment.