Skip to content

Commit 65129bc

Browse files
committed
tests
1 parent e23a2d3 commit 65129bc

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/e2e/fail-threshold-onpostbuild.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ describe('lighthousePlugin with failed threshold run (onPostBuild)', () => {
3434

3535
it('should output expected log content', async () => {
3636
const logs = [
37-
'Persisting Lighthouse cache...',
38-
'Lighthouse cache persisted',
37+
'Restoring Lighthouse cache...',
38+
'Lighthouse cache restored',
3939
'Generating Lighthouse report. This may take a minute…',
4040
'Running Lighthouse on example/',
4141
'Serving and scanning site from directory example',
@@ -45,6 +45,8 @@ describe('lighthousePlugin with failed threshold run (onPostBuild)', () => {
4545
'- Best Practices: 100',
4646
'- SEO: 91',
4747
'- PWA: 30',
48+
'Persisting Lighthouse cache...',
49+
'Lighthouse cache persisted',
4850
];
4951

5052
await lighthousePlugin({

src/e2e/settings-preset.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ describe('lighthousePlugin with custom device preset', () => {
2929

3030
it('should output expected log content', async () => {
3131
const logs = [
32+
'Restoring Lighthouse cache...',
33+
'Lighthouse cache restored',
3234
'Generating Lighthouse report. This may take a minute…',
3335
'Running Lighthouse on / using the “desktop” preset',
3436
'Lighthouse scores for /',
@@ -37,6 +39,8 @@ describe('lighthousePlugin with custom device preset', () => {
3739
'- Best Practices: 100',
3840
'- SEO: 91',
3941
'- PWA: 30',
42+
'Persisting Lighthouse cache...',
43+
'Lighthouse cache persisted',
4044
];
4145
await lighthousePlugin().onSuccess({ utils: mockUtils });
4246
expect(formatMockLog(console.log.mock.calls)).toEqual(logs);

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export default function lighthousePlugin(inputs) {
3333
if (defaultEvent === 'onSuccess') {
3434
return {
3535
onSuccess: async ({ constants, utils, inputs } = {}) => {
36-
console.log('🚨 LIGHTHOUSE PLUGIN onSuccess invoked');
3736
await restorePuppeteerCache({ utils });
3837
// Mock the required `utils` functions if running locally
3938
const { failPlugin, show } = getUtils({ utils });

src/index.test.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@ import lighthousePlugin from './index.js';
22

33
describe('lighthousePlugin plugin events', () => {
44
describe('when fail_deploy_on_score_thresholds is true', () => {
5-
it('should return onPreBuild and onPostBuild events', async () => {
5+
it('should return onPostBuild events', async () => {
66
const events = lighthousePlugin({
77
fail_deploy_on_score_thresholds: 'true',
88
});
99
expect(events).toEqual({
10-
onPreBuild: expect.any(Function),
1110
onPostBuild: expect.any(Function),
1211
});
1312
});
1413
});
1514

1615
describe('default behavior', () => {
17-
it('should return onPreBuild, onPostBuild and onSuccess events', async () => {
16+
it('should return onSuccess event', async () => {
1817
const events = lighthousePlugin();
1918
expect(events).toEqual({
20-
onPreBuild: expect.any(Function),
21-
onPostBuild: expect.any(Function),
2219
onSuccess: expect.any(Function),
2320
});
2421
});

0 commit comments

Comments
 (0)