Skip to content

Commit

Permalink
tests(lantern): fix some tests not running
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Jun 12, 2024
1 parent 6859c5f commit b19a516
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/lib/lantern/metrics/FirstContentfulPaint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {getComputationDataFromFixture} from './MetricTestUtils.js';

const {FirstContentfulPaint} = Lantern.Metrics;

const trace = readJson('../../../fixtures/artifacts/progressive-app/trace.json', import.meta);
const trace = readJson('../../../test/fixtures/artifacts/progressive-app/trace.json', import.meta);

describe('Metrics: Lantern FCP', () => {
it('should compute predicted value', async () => {
Expand Down
4 changes: 2 additions & 2 deletions core/lib/lantern/metrics/Interactive.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {readJson} from '../../../test/test-utils.js';

const {Interactive, FirstContentfulPaint, LargestContentfulPaint} = Lantern.Metrics;

const trace = readJson('../../../fixtures/artifacts/progressive-app/trace.json', import.meta);
const iframeTrace = readJson('../../../fixtures/artifacts/iframe/trace.json', import.meta);
const trace = readJson('../../../test/fixtures/artifacts/progressive-app/trace.json', import.meta);
const iframeTrace = readJson('../../../test/fixtures/artifacts/iframe/trace.json', import.meta);

describe('Metrics: Lantern TTI', () => {
it('should compute predicted value', async () => {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/lantern/metrics/LargestContentfulPaint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {readJson} from '../../../test/test-utils.js';

const {FirstContentfulPaint, LargestContentfulPaint} = Lantern.Metrics;

const trace = readJson('../../../fixtures/artifacts/paul/trace.json', import.meta);
const trace = readJson('../../../test/fixtures/artifacts/paul/trace.json', import.meta);

describe('Metrics: Lantern LCP', () => {
it('should compute predicted value', async () => {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/lantern/metrics/SpeedIndex.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {getComputationDataFromFixture} from './MetricTestUtils.js';

const {SpeedIndex, FirstContentfulPaint} = Lantern.Metrics;

const trace = readJson('../../../fixtures/artifacts/progressive-app/trace.json', import.meta);
const trace = readJson('../../../test/fixtures/artifacts/progressive-app/trace.json', import.meta);

const defaultThrottling = Lantern.Simulation.Constants.throttling.mobileSlow4G;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Metrics: Lantern FCP should compute predicted value 1`] = `
Object {
"optimistic": 1107,
"optimisticNodeTimings": 4,
"pessimistic": 1107,
"pessimisticNodeTimings": 4,
"timing": 1107,
}
`;
17 changes: 17 additions & 0 deletions core/lib/lantern/metrics/__snapshots__/Interactive.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Metrics: Lantern TTI should compute predicted value 1`] = `
Object {
"optimistic": 1107,
"pessimistic": 1134,
"timing": 1122,
}
`;

exports[`Metrics: Lantern TTI should compute predicted value on iframes with substantial layout 1`] = `
Object {
"optimistic": 2372,
"pessimistic": 2386,
"timing": 2379,
}
`;
4 changes: 2 additions & 2 deletions core/lib/lantern/simulation/NetworkAnalyzer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {runTraceEngine} from '../metrics/MetricTestUtils.js';

const {NetworkAnalyzer} = Lantern.Simulation;

const trace = readJson('../../../fixtures/artifacts/paul/trace.json', import.meta);
const traceWithRedirect = readJson('../../../fixtures/artifacts/redirect/trace.json', import.meta);
const trace = readJson('../../../test/fixtures/artifacts/paul/trace.json', import.meta);
const traceWithRedirect = readJson('../../../test/fixtures/artifacts/redirect/trace.json', import.meta);

/**
* @param {Lantern.Trace} trace
Expand Down
4 changes: 2 additions & 2 deletions core/lib/lantern/simulation/Simulator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import assert from 'assert/strict';

import * as Lantern from '../lantern.js';
import {readJson} from '../../../test/test-utils.js';
import {runTraceEngine} from '../../../test/lib/lantern/metrics/MetricTestUtils.js';
import {runTraceEngine} from '../metrics/MetricTestUtils.js';

const {NetworkNode, CPUNode} = Lantern;
const {Simulator, DNSCache} = Lantern.Simulation;

const pwaTrace = readJson('../../../fixtures/artifacts/progressive-app/trace.json', import.meta);
const pwaTrace = readJson('../../../test/fixtures/artifacts/progressive-app/trace.json', import.meta);

let nextRequestId = 1;
let nextTid = 1;
Expand Down
2 changes: 1 addition & 1 deletion core/test/scripts/run-mocha-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const defaultTestMatches = [
'cli/**/*-test.js',
'core/**/*-test.js',
'core/test/**/*-test-pptr.js',
'core/lib/lantern/*.test.js',
'core/lib/lantern/**/*.test.js',
'report/**/*-test.js',
'shared/**/*-test.js',
'third-party/**/*-test.js',
Expand Down

0 comments on commit b19a516

Please sign in to comment.