Skip to content

Commit

Permalink
experimental-
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Apr 26, 2022
1 parent 5bceb55 commit dad51d4
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);
/**
* @fileoverview This metric gives a high-percentile measure of responsiveness to input.
*/
class InteractionToNextPaint extends Audit {
class ExperimentalInteractionToNextPaint extends Audit {
/**
* @return {LH.Audit.Meta}
*/
static get meta() {
return {
id: 'interaction-to-next-paint',
id: 'experimental-interaction-to-next-paint',
title: str_(i18n.UIStrings.interactionToNextPaint),
description: str_(UIStrings.description),
scoreDisplayMode: Audit.SCORING_MODES.NUMERIC,
Expand Down Expand Up @@ -80,5 +80,5 @@ class InteractionToNextPaint extends Audit {
}
}

module.exports = InteractionToNextPaint;
module.exports = ExperimentalInteractionToNextPaint;
module.exports.UIStrings = UIStrings;
4 changes: 2 additions & 2 deletions lighthouse-core/fraggle-rock/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ const {deepClone} = require('../../config/config-helpers.js');
/** @type {LH.Config.AuditJson[]} */
const frAudits = [
'byte-efficiency/uses-responsive-images-snapshot',
'metrics/interaction-to-next-paint',
'metrics/experimental-interaction-to-next-paint',
];

/** @type {Record<string, LH.Config.AuditRefJson[]>} */
const frCategoryAuditRefExtensions = {
'performance': [
{id: 'uses-responsive-images-snapshot', weight: 0},
{id: 'interaction-to-next-paint', weight: 30, group: 'metrics', acronym: 'INP'},
{id: 'experimental-interaction-to-next-paint', weight: 30, group: 'metrics', acronym: 'INP'},
],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/
'use strict';

const InteractionToNextPaint = require('../../../audits/metrics/interaction-to-next-paint.js');
const ExperimentalInteractionToNextPaint =
require('../../../audits/metrics/experimental-interaction-to-next-paint.js');
const interactionTrace = require('../../fixtures/traces/timespan-responsiveness.trace.json');
const noInteractionTrace = require('../../fixtures/traces/jumpy-cls-m90.json');

Expand All @@ -15,22 +16,22 @@ describe('Interaction to Next Paint', () => {
function getTestData() {
const artifacts = {
traces: {
[InteractionToNextPaint.DEFAULT_PASS]: interactionTrace,
[ExperimentalInteractionToNextPaint.DEFAULT_PASS]: interactionTrace,
},
};

const context = {
settings: {throttlingMethod: 'devtools'},
computedCache: new Map(),
options: InteractionToNextPaint.defaultOptions,
options: ExperimentalInteractionToNextPaint.defaultOptions,
};

return {artifacts, context};
}

it('evaluates INP correctly', async () => {
const {artifacts, context} = getTestData();
const result = await InteractionToNextPaint.audit(artifacts, context);
const result = await ExperimentalInteractionToNextPaint.audit(artifacts, context);
expect(result).toEqual({
score: 0.63,
numericValue: 392,
Expand All @@ -42,7 +43,7 @@ describe('Interaction to Next Paint', () => {
it('is not applicable if using simulated throttling', async () => {
const {artifacts, context} = getTestData();
context.settings.throttlingMethod = 'simulate';
const result = await InteractionToNextPaint.audit(artifacts, context);
const result = await ExperimentalInteractionToNextPaint.audit(artifacts, context);
expect(result).toMatchObject({
score: null,
notApplicable: true,
Expand All @@ -51,8 +52,8 @@ describe('Interaction to Next Paint', () => {

it('is not applicable if no interactions occurred in trace', async () => {
const {artifacts, context} = getTestData();
artifacts.traces[InteractionToNextPaint.DEFAULT_PASS] = noInteractionTrace;
const result = await InteractionToNextPaint.audit(artifacts, context);
artifacts.traces[ExperimentalInteractionToNextPaint.DEFAULT_PASS] = noInteractionTrace;
const result = await ExperimentalInteractionToNextPaint.audit(artifacts, context);
expect(result).toMatchObject({
score: null,
notApplicable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9088,8 +9088,8 @@
"items": []
}
},
"interaction-to-next-paint": {
"id": "interaction-to-next-paint",
"experimental-interaction-to-next-paint": {
"id": "experimental-interaction-to-next-paint",
"title": "Interaction to Next Paint",
"description": "Interaction to Next Paint measures page responsiveness, how long it takes the page to visibly respond to user input. [Learn more](https://web.dev/inp/).",
"score": 1,
Expand Down Expand Up @@ -9311,7 +9311,7 @@
"group": "hidden"
},
{
"id": "interaction-to-next-paint",
"id": "experimental-interaction-to-next-paint",
"weight": 30,
"group": "metrics",
"acronym": "INP"
Expand Down Expand Up @@ -9928,7 +9928,7 @@
},
{
"startTime": 78,
"name": "lh:audit:interaction-to-next-paint",
"name": "lh:audit:experimental-interaction-to-next-paint",
"duration": 1,
"entryType": "measure"
},
Expand Down Expand Up @@ -10038,7 +10038,7 @@
"values": {
"timeInMs": 60
},
"path": "audits[interaction-to-next-paint].displayValue"
"path": "audits[experimental-interaction-to-next-paint].displayValue"
}
],
"lighthouse-core/lib/i18n/i18n.js | cumulativeLayoutShiftMetric": [
Expand Down Expand Up @@ -10427,10 +10427,10 @@
"audits[uses-passive-event-listeners].description"
],
"lighthouse-core/lib/i18n/i18n.js | interactionToNextPaint": [
"audits[interaction-to-next-paint].title"
"audits[experimental-interaction-to-next-paint].title"
],
"lighthouse-core/audits/metrics/interaction-to-next-paint.js | description": [
"audits[interaction-to-next-paint].description"
"lighthouse-core/audits/metrics/experimental-interaction-to-next-paint.js | description": [
"audits[experimental-interaction-to-next-paint].description"
],
"lighthouse-core/config/default-config.js | performanceCategoryTitle": [
"categories.performance.title"
Expand Down
6 changes: 3 additions & 3 deletions shared/localization/locales/en-US.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions shared/localization/locales/en-XL.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dad51d4

Please sign in to comment.