Skip to content

Commit 9b66701

Browse files
committed
rename input to fail_deploy_on_score_thresholds
1 parent c5751e8 commit 9b66701

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ You can add additional configuration and/or inspect a different path, or multipl
106106

107107
By default, the lighthouse plugin will run _after_ your deploy has been successful, auditing the live deploy content.
108108

109-
To run the plugin _before_ the deploy is live, use the `block_deploy_on_failed_threshold` input to instead run during the `onPostBuild` event.
109+
To run the plugin _before_ the deploy is live, use the `fail_deploy_on_score_thresholds` input to instead run during the `onPostBuild` event.
110110
This will statically serve your build output folder, and audit the `index.html` (or other file if specified as below). Using this configuration, if minimum threshold scores are supplied and not met, the deploy will fail.
111111
Set the threshold based on `performance`, `accessibility`, `best-practices`, `seo`, or `pwa`.
112112

@@ -116,7 +116,7 @@ Set the threshold based on `performance`, `accessibility`, `best-practices`, `se
116116

117117
# Set the plugin to run prior to deploy, failing the build if minimum thresholds aren't set
118118
[plugins.inputs]
119-
block_deploy_on_failed_threshold = "true"
119+
fail_deploy_on_score_thresholds = "true"
120120

121121
# Set minimum thresholds for each report area
122122
[plugins.inputs.thresholds]

manifest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ inputs:
2121
required: false
2222
description: Lighthouse-specific settings, used to modify reporting criteria
2323

24-
- name: block_deploy_on_failed_threshold
24+
- name: fail_deploy_on_score_thresholds
2525
required: false
26-
description: Prevent deploy if minimum threshold scores are not met
26+
description: Fail deploy if minimum threshold scores are not met

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "src/index.js",
66
"scripts": {
77
"local": "node -e 'import(\"./src/index.js\").then(index => index.default()).then(events => events.onSuccess());'",
8-
"local-onpostbuild": "node -e 'import(\"./src/index.js\").then(index => index.default({block_deploy_on_failed_threshold: \"true\"})).then(events => events.onPostBuild());'",
8+
"local-onpostbuild": "node -e 'import(\"./src/index.js\").then(index => index.default({fail_deploy_on_score_thresholds: \"true\"})).then(events => events.onPostBuild());'",
99
"lint": "eslint 'src/**/*.js'",
1010
"format": "prettier --write 'src/**/*.js'",
1111
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --collect-coverage --maxWorkers=1",

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

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

48-
await lighthousePlugin({block_deploy_on_failed_threshold: 'true'}).onPostBuild({ utils: mockUtils });
48+
await lighthousePlugin({fail_deploy_on_score_thresholds: 'true'}).onPostBuild({ utils: mockUtils });
4949
expect(formatMockLog(console.log.mock.calls)).toEqual(logs);
5050
});
5151

5252
it('should not output expected success payload', async () => {
53-
await lighthousePlugin({block_deploy_on_failed_threshold: 'true'}).onPostBuild({ utils: mockUtils, });
53+
await lighthousePlugin({fail_deploy_on_score_thresholds: 'true'}).onPostBuild({ utils: mockUtils, });
5454
expect(mockUtils.status.show).not.toHaveBeenCalledWith();
5555
});
5656

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

70-
await lighthousePlugin({block_deploy_on_failed_threshold: 'true'}).onPostBuild({ utils: mockUtils });
70+
await lighthousePlugin({fail_deploy_on_score_thresholds: 'true'}).onPostBuild({ utils: mockUtils });
7171
const resultError = console.error.mock.calls[0][0];
7272
expect(stripAnsi(resultError).split('\n').filter(Boolean)).toEqual(error);
7373
});
@@ -99,7 +99,7 @@ describe('lighthousePlugin with failed threshold run (onPostBuild)', () => {
9999
],
100100
};
101101

102-
await lighthousePlugin({block_deploy_on_failed_threshold: 'true'}).onPostBuild({ utils: mockUtils });
102+
await lighthousePlugin({fail_deploy_on_score_thresholds: 'true'}).onPostBuild({ utils: mockUtils });
103103
const [resultMessage, resultPayload] =
104104
mockUtils.build.failBuild.mock.calls[0];
105105

src/e2e/not-found-onpostbuild.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('lighthousePlugin with single not-found run (onPostBuild)', () => {
3333
];
3434

3535
await lighthousePlugin({
36-
block_deploy_on_failed_threshold: 'true',
36+
fail_deploy_on_score_thresholds: 'true',
3737
}).onPostBuild({ utils: mockUtils });
3838
expect(formatMockLog(console.log.mock.calls)).toEqual(logs);
3939
});
@@ -55,7 +55,7 @@ describe('lighthousePlugin with single not-found run (onPostBuild)', () => {
5555
};
5656

5757
await lighthousePlugin({
58-
block_deploy_on_failed_threshold: 'true',
58+
fail_deploy_on_score_thresholds: 'true',
5959
}).onPostBuild({ utils: mockUtils });
6060
expect(mockUtils.status.show).toHaveBeenCalledWith(payload);
6161
});
@@ -64,7 +64,7 @@ describe('lighthousePlugin with single not-found run (onPostBuild)', () => {
6464
mockConsoleError();
6565

6666
await lighthousePlugin({
67-
block_deploy_on_failed_threshold: 'true',
67+
fail_deploy_on_score_thresholds: 'true',
6868
}).onPostBuild({ utils: mockUtils });
6969
expect(console.error).not.toHaveBeenCalled();
7070
expect(mockUtils.build.failBuild).not.toHaveBeenCalled();

src/e2e/success-onpostbuild.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('lighthousePlugin with single report per run (onPostBuild)', () => {
3535
'- PWA: 30',
3636
];
3737
await lighthousePlugin({
38-
block_deploy_on_failed_threshold: 'true',
38+
fail_deploy_on_score_thresholds: 'true',
3939
}).onPostBuild({ utils: mockUtils });
4040
expect(formatMockLog(console.log.mock.calls)).toEqual(logs);
4141
});
@@ -65,7 +65,7 @@ describe('lighthousePlugin with single report per run (onPostBuild)', () => {
6565
};
6666

6767
await lighthousePlugin({
68-
block_deploy_on_failed_threshold: 'true',
68+
fail_deploy_on_score_thresholds: 'true',
6969
}).onPostBuild({ utils: mockUtils });
7070
expect(mockUtils.status.show).toHaveBeenCalledWith(payload);
7171
});
@@ -74,7 +74,7 @@ describe('lighthousePlugin with single report per run (onPostBuild)', () => {
7474
mockConsoleError();
7575

7676
await lighthousePlugin({
77-
block_deploy_on_failed_threshold: 'true',
77+
fail_deploy_on_score_thresholds: 'true',
7878
}).onPostBuild({ utils: mockUtils });
7979
expect(console.error).not.toHaveBeenCalled();
8080
expect(mockUtils.build.failBuild).not.toHaveBeenCalled();

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ dotenv.config();
77

88
export default function lighthousePlugin(inputs) {
99

10-
// Run onSuccess by default, unless inputs specify we should block_deploy_on_failed_threshold
10+
// Run onSuccess by default, unless inputs specify we should fail_deploy_on_score_thresholds
1111
const defaultEvent =
12-
inputs?.block_deploy_on_failed_threshold === 'true'
12+
inputs?.fail_deploy_on_score_thresholds === 'true'
1313
? 'onPostBuild'
1414
: 'onSuccess';
1515

src/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ 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({block_deploy_on_failed_threshold: 'true'});
6+
const events = lighthousePlugin({fail_deploy_on_score_thresholds: 'true'});
77
expect(events).toEqual({
88
onPostBuild: expect.any(Function),
99
});

0 commit comments

Comments
 (0)