Skip to content

Commit 841ce2f

Browse files
committed
fix formatting
1 parent 9b66701 commit 841ce2f

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ describe('lighthousePlugin with failed threshold run (onPostBuild)', () => {
4545
'- PWA: 30',
4646
];
4747

48-
await lighthousePlugin({fail_deploy_on_score_thresholds: 'true'}).onPostBuild({ utils: mockUtils });
48+
await lighthousePlugin({
49+
fail_deploy_on_score_thresholds: 'true',
50+
}).onPostBuild({ utils: mockUtils });
4951
expect(formatMockLog(console.log.mock.calls)).toEqual(logs);
5052
});
5153

5254
it('should not output expected success payload', async () => {
53-
await lighthousePlugin({fail_deploy_on_score_thresholds: 'true'}).onPostBuild({ utils: mockUtils, });
55+
await lighthousePlugin({
56+
fail_deploy_on_score_thresholds: 'true',
57+
}).onPostBuild({ utils: mockUtils });
5458
expect(mockUtils.status.show).not.toHaveBeenCalledWith();
5559
});
5660

@@ -67,7 +71,9 @@ describe('lighthousePlugin with failed threshold run (onPostBuild)', () => {
6771
" 'Manifest doesn't have a maskable icon' received a score of 0",
6872
];
6973

70-
await lighthousePlugin({fail_deploy_on_score_thresholds: 'true'}).onPostBuild({ utils: mockUtils });
74+
await lighthousePlugin({
75+
fail_deploy_on_score_thresholds: 'true',
76+
}).onPostBuild({ utils: mockUtils });
7177
const resultError = console.error.mock.calls[0][0];
7278
expect(stripAnsi(resultError).split('\n').filter(Boolean)).toEqual(error);
7379
});
@@ -99,7 +105,9 @@ describe('lighthousePlugin with failed threshold run (onPostBuild)', () => {
99105
],
100106
};
101107

102-
await lighthousePlugin({fail_deploy_on_score_thresholds: 'true'}).onPostBuild({ utils: mockUtils });
108+
await lighthousePlugin({
109+
fail_deploy_on_score_thresholds: 'true',
110+
}).onPostBuild({ utils: mockUtils });
103111
const [resultMessage, resultPayload] =
104112
mockUtils.build.failBuild.mock.calls[0];
105113

src/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import getUtils from './lib/get-utils/index.js';
66
dotenv.config();
77

88
export default function lighthousePlugin(inputs) {
9-
109
// Run onSuccess by default, unless inputs specify we should fail_deploy_on_score_thresholds
1110
const defaultEvent =
12-
inputs?.fail_deploy_on_score_thresholds === 'true'
11+
inputs?.fail_deploy_on_score_thresholds === 'true'
1312
? 'onPostBuild'
1413
: 'onSuccess';
1514

16-
1715
if (defaultEvent === 'onSuccess') {
1816
return {
1917
onSuccess: async ({ constants, utils, inputs } = {}) => {

src/index.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import lighthousePlugin from './index.js';
33
describe('lighthousePlugin plugin events', () => {
44
describe('onPostBuild', () => {
55
it('should return only the expected event function', async () => {
6-
const events = lighthousePlugin({fail_deploy_on_score_thresholds: 'true'});
6+
const events = lighthousePlugin({
7+
fail_deploy_on_score_thresholds: 'true',
8+
});
79
expect(events).toEqual({
810
onPostBuild: expect.any(Function),
911
});

0 commit comments

Comments
 (0)