lighthouse 10.0.0 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog-pre10.md +6085 -0
- package/core/audits/dobetterweb/doctype.d.ts +3 -2
- package/core/audits/dobetterweb/doctype.js +15 -4
- package/core/audits/dobetterweb/paste-preventing-inputs.js +2 -2
- package/core/gather/driver/network-monitor.js +1 -3
- package/core/gather/gatherers/bf-cache-failures.js +7 -8
- package/package.json +2 -2
- package/shared/localization/locales/en-US.json +1 -1
- package/shared/localization/locales/en-XL.json +1 -1
- package/.codecov.yml +0 -22
- package/.cz-config.js +0 -24
- package/.gitattributes +0 -5
- package/.mailmap +0 -6
- package/CODE_OF_CONDUCT.md +0 -93
- package/eslint-local-rules.cjs +0 -106
- package/flow-report/test/app-test.d.ts +0 -7
- package/flow-report/test/app-test.tsx +0 -52
- package/flow-report/test/common-test.d.ts +0 -7
- package/flow-report/test/common-test.tsx +0 -103
- package/flow-report/test/flow-report-pptr-test.d.ts +0 -7
- package/flow-report/test/flow-report-pptr-test.ts +0 -59
- package/flow-report/test/header-test.d.ts +0 -7
- package/flow-report/test/header-test.tsx +0 -55
- package/flow-report/test/run-flow-report-tests.sh +0 -20
- package/flow-report/test/sample-flow.d.ts +0 -7
- package/flow-report/test/sample-flow.ts +0 -17
- package/flow-report/test/setup/env-setup.d.ts +0 -11
- package/flow-report/test/setup/env-setup.ts +0 -55
- package/flow-report/test/sidebar/flow-test.d.ts +0 -7
- package/flow-report/test/sidebar/flow-test.tsx +0 -65
- package/flow-report/test/sidebar/sidebar-test.d.ts +0 -7
- package/flow-report/test/sidebar/sidebar-test.tsx +0 -116
- package/flow-report/test/summary/category-test.d.ts +0 -7
- package/flow-report/test/summary/category-test.tsx +0 -206
- package/flow-report/test/summary/summary-test.d.ts +0 -7
- package/flow-report/test/summary/summary-test.tsx +0 -124
- package/flow-report/test/topbar-test.d.ts +0 -7
- package/flow-report/test/topbar-test.tsx +0 -84
- package/flow-report/test/util-test.d.ts +0 -7
- package/flow-report/test/util-test.tsx +0 -133
- package/flow-report/test/wrappers/category-score-test.d.ts +0 -7
- package/flow-report/test/wrappers/category-score-test.tsx +0 -84
- package/flow-report/test/wrappers/markdown-test.d.ts +0 -7
- package/flow-report/test/wrappers/markdown-test.tsx +0 -17
- package/report/test/clients/bundle-test.js +0 -65
- package/report/test/generator/file-namer-test.js +0 -27
- package/report/test/generator/report-generator-test.js +0 -160
- package/report/test/renderer/__snapshots__/report-renderer-axe-test.js.snap +0 -15
- package/report/test/renderer/category-renderer-test.js +0 -575
- package/report/test/renderer/components-test.js +0 -124
- package/report/test/renderer/crc-details-renderer-test.js +0 -116
- package/report/test/renderer/details-renderer-test.js +0 -882
- package/report/test/renderer/dom-test.js +0 -257
- package/report/test/renderer/element-screenshot-renderer-test.js +0 -183
- package/report/test/renderer/i18n-formatter-test.js +0 -179
- package/report/test/renderer/performance-category-renderer-test.js +0 -417
- package/report/test/renderer/pwa-category-renderer-test.js +0 -301
- package/report/test/renderer/report-renderer-axe-test.js +0 -85
- package/report/test/renderer/report-renderer-test.js +0 -268
- package/report/test/renderer/report-ui-features-test.js +0 -773
- package/report/test/renderer/report-utils-test.js +0 -219
- package/report/test/renderer/snippet-renderer-test.js +0 -291
- package/report/test/renderer/text-encoding-test.js +0 -43
- package/report/test-assets/faux-psi.d.ts +0 -34
- package/shared/test/localization/format-test.js +0 -430
- package/shared/test/localization/locales-test.js +0 -45
- package/shared/test/localization/swap-locale-test.js +0 -127
- package/shared/test/util-test.js +0 -214
- package/vercel.json +0 -6
package/shared/test/util-test.js
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright 2017 The Lighthouse Authors. All Rights Reserved.
|
|
3
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
4
|
-
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import assert from 'assert/strict';
|
|
8
|
-
|
|
9
|
-
import {Util} from '../util.js';
|
|
10
|
-
|
|
11
|
-
describe('util helpers', () => {
|
|
12
|
-
describe('getTld', () => {
|
|
13
|
-
it('returns the correct tld', () => {
|
|
14
|
-
assert.equal(Util.getTld('example.com'), '.com');
|
|
15
|
-
assert.equal(Util.getTld('example.co.uk'), '.co.uk');
|
|
16
|
-
assert.equal(Util.getTld('example.com.br'), '.com.br');
|
|
17
|
-
assert.equal(Util.getTld('example.tokyo.jp'), '.jp');
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe('getRootDomain', () => {
|
|
22
|
-
it('returns the correct rootDomain from a string', () => {
|
|
23
|
-
assert.equal(Util.getRootDomain('https://www.example.com/index.html'), 'example.com');
|
|
24
|
-
assert.equal(Util.getRootDomain('https://example.com'), 'example.com');
|
|
25
|
-
assert.equal(Util.getRootDomain('https://www.example.co.uk'), 'example.co.uk');
|
|
26
|
-
assert.equal(Util.getRootDomain('https://example.com.br/app/'), 'example.com.br');
|
|
27
|
-
assert.equal(Util.getRootDomain('https://example.tokyo.jp'), 'tokyo.jp');
|
|
28
|
-
assert.equal(Util.getRootDomain('https://sub.example.com'), 'example.com');
|
|
29
|
-
assert.equal(Util.getRootDomain('https://sub.example.tokyo.jp'), 'tokyo.jp');
|
|
30
|
-
assert.equal(Util.getRootDomain('http://localhost'), 'localhost');
|
|
31
|
-
assert.equal(Util.getRootDomain('http://localhost:8080'), 'localhost');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('returns the correct rootDomain from an URL object', () => {
|
|
35
|
-
assert.equal(Util.getRootDomain(new URL('https://www.example.com/index.html')), 'example.com');
|
|
36
|
-
assert.equal(Util.getRootDomain(new URL('https://example.com')), 'example.com');
|
|
37
|
-
assert.equal(Util.getRootDomain(new URL('https://www.example.co.uk')), 'example.co.uk');
|
|
38
|
-
assert.equal(Util.getRootDomain(new URL('https://example.com.br/app/')), 'example.com.br');
|
|
39
|
-
assert.equal(Util.getRootDomain(new URL('https://example.tokyo.jp')), 'tokyo.jp');
|
|
40
|
-
assert.equal(Util.getRootDomain(new URL('https://sub.example.com')), 'example.com');
|
|
41
|
-
assert.equal(Util.getRootDomain(new URL('https://sub.example.tokyo.jp')), 'tokyo.jp');
|
|
42
|
-
assert.equal(Util.getRootDomain(new URL('http://localhost')), 'localhost');
|
|
43
|
-
assert.equal(Util.getRootDomain(new URL('http://localhost:8080')), 'localhost');
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
describe('#splitMarkdownCodeSpans', () => {
|
|
48
|
-
it('handles strings with no backticks in them', () => {
|
|
49
|
-
expect(Util.splitMarkdownCodeSpans('regular text')).toEqual([
|
|
50
|
-
{isCode: false, text: 'regular text'},
|
|
51
|
-
]);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('does not split on a single backtick', () => {
|
|
55
|
-
expect(Util.splitMarkdownCodeSpans('regular `text')).toEqual([
|
|
56
|
-
{isCode: false, text: 'regular `text'},
|
|
57
|
-
]);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('splits on backticked code', () => {
|
|
61
|
-
expect(Util.splitMarkdownCodeSpans('regular `code` text')).toEqual([
|
|
62
|
-
{isCode: false, text: 'regular '},
|
|
63
|
-
{isCode: true, text: 'code'},
|
|
64
|
-
{isCode: false, text: ' text'},
|
|
65
|
-
]);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('splits on backticked code at the beginning of the string', () => {
|
|
69
|
-
expect(Util.splitMarkdownCodeSpans('`start code` regular text')).toEqual([
|
|
70
|
-
{isCode: true, text: 'start code'},
|
|
71
|
-
{isCode: false, text: ' regular text'},
|
|
72
|
-
]);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('splits on backticked code at the end of the string', () => {
|
|
76
|
-
expect(Util.splitMarkdownCodeSpans('regular text `end code`')).toEqual([
|
|
77
|
-
{isCode: false, text: 'regular text '},
|
|
78
|
-
{isCode: true, text: 'end code'},
|
|
79
|
-
]);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('does not split on a single backtick after split out backticked code', () => {
|
|
83
|
-
expect(Util.splitMarkdownCodeSpans('regular text `code` and more `text')).toEqual([
|
|
84
|
-
{isCode: false, text: 'regular text '},
|
|
85
|
-
{isCode: true, text: 'code'},
|
|
86
|
-
{isCode: false, text: ' and more `text'},
|
|
87
|
-
]);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('splits on two instances of backticked code', () => {
|
|
91
|
-
expect(Util.splitMarkdownCodeSpans('regular text `code` more text `and more code`')).toEqual([
|
|
92
|
-
{isCode: false, text: 'regular text '},
|
|
93
|
-
{isCode: true, text: 'code'},
|
|
94
|
-
{isCode: false, text: ' more text '},
|
|
95
|
-
{isCode: true, text: 'and more code'},
|
|
96
|
-
]);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('splits on two directly adjacent instances of backticked code', () => {
|
|
100
|
-
// eslint-disable-next-line max-len
|
|
101
|
-
expect(Util.splitMarkdownCodeSpans('regular text `first code``second code` end text')).toEqual([
|
|
102
|
-
{isCode: false, text: 'regular text '},
|
|
103
|
-
{isCode: true, text: 'first code'},
|
|
104
|
-
{isCode: true, text: 'second code'},
|
|
105
|
-
{isCode: false, text: ' end text'},
|
|
106
|
-
]);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('handles text only within backticks', () => {
|
|
110
|
-
expect(Util.splitMarkdownCodeSpans('`first code``second code`')).toEqual([
|
|
111
|
-
{isCode: true, text: 'first code'},
|
|
112
|
-
{isCode: true, text: 'second code'},
|
|
113
|
-
]);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('splits on two instances of backticked code separated by only a space', () => {
|
|
117
|
-
// eslint-disable-next-line max-len
|
|
118
|
-
expect(Util.splitMarkdownCodeSpans('`first code` `second code`')).toEqual([
|
|
119
|
-
{isCode: true, text: 'first code'},
|
|
120
|
-
{isCode: false, text: ' '},
|
|
121
|
-
{isCode: true, text: 'second code'},
|
|
122
|
-
]);
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
describe('#splitMarkdownLink', () => {
|
|
127
|
-
it('handles strings with no links in them', () => {
|
|
128
|
-
expect(Util.splitMarkdownLink('some text')).toEqual([
|
|
129
|
-
{isLink: false, text: 'some text'},
|
|
130
|
-
]);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('does not split on an incomplete markdown link', () => {
|
|
134
|
-
expect(Util.splitMarkdownLink('some [not link text](text')).toEqual([
|
|
135
|
-
{isLink: false, text: 'some [not link text](text'},
|
|
136
|
-
]);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('splits on a markdown link', () => {
|
|
140
|
-
expect(Util.splitMarkdownLink('some [link text](https://example.com) text')).toEqual([
|
|
141
|
-
{isLink: false, text: 'some '},
|
|
142
|
-
{isLink: true, text: 'link text', linkHref: 'https://example.com'},
|
|
143
|
-
{isLink: false, text: ' text'},
|
|
144
|
-
]);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it('splits on an http markdown link', () => {
|
|
148
|
-
expect(Util.splitMarkdownLink('you should [totally click here](http://never-mitm.com) now')).toEqual([
|
|
149
|
-
{isLink: false, text: 'you should '},
|
|
150
|
-
{isLink: true, text: 'totally click here', linkHref: 'http://never-mitm.com'},
|
|
151
|
-
{isLink: false, text: ' now'},
|
|
152
|
-
]);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it('does not split on a non-http/https link', () => {
|
|
156
|
-
expect(Util.splitMarkdownLink('some [link text](ftp://example.com) text')).toEqual([
|
|
157
|
-
{isLink: false, text: 'some [link text](ftp://example.com) text'},
|
|
158
|
-
]);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('does not split on a malformed markdown link', () => {
|
|
162
|
-
expect(Util.splitMarkdownLink('some [link ]text](https://example.com')).toEqual([
|
|
163
|
-
{isLink: false, text: 'some [link ]text](https://example.com'},
|
|
164
|
-
]);
|
|
165
|
-
|
|
166
|
-
expect(Util.splitMarkdownLink('some [link text] (https://example.com')).toEqual([
|
|
167
|
-
{isLink: false, text: 'some [link text] (https://example.com'},
|
|
168
|
-
]);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it('does not split on empty link text', () => {
|
|
172
|
-
expect(Util.splitMarkdownLink('some [](https://example.com) empty link')).toEqual([
|
|
173
|
-
{isLink: false, text: 'some [](https://example.com) empty link'},
|
|
174
|
-
]);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it('splits on a markdown link at the beginning of a string', () => {
|
|
178
|
-
expect(Util.splitMarkdownLink('[link text](https://example.com) end text')).toEqual([
|
|
179
|
-
{isLink: true, text: 'link text', linkHref: 'https://example.com'},
|
|
180
|
-
{isLink: false, text: ' end text'},
|
|
181
|
-
]);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it('splits on a markdown link at the end of a string', () => {
|
|
185
|
-
expect(Util.splitMarkdownLink('start text [link text](https://example.com)')).toEqual([
|
|
186
|
-
{isLink: false, text: 'start text '},
|
|
187
|
-
{isLink: true, text: 'link text', linkHref: 'https://example.com'},
|
|
188
|
-
]);
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
it('handles a string consisting only of a markdown link', () => {
|
|
192
|
-
expect(Util.splitMarkdownLink(`[I'm only a link](https://example.com)`)).toEqual([
|
|
193
|
-
{isLink: true, text: `I'm only a link`, linkHref: 'https://example.com'},
|
|
194
|
-
]);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
it('handles a string starting and ending with a markdown link', () => {
|
|
198
|
-
expect(Util.splitMarkdownLink('[first link](https://first.com) other text [second link](https://second.com)')).toEqual([
|
|
199
|
-
{isLink: true, text: 'first link', linkHref: 'https://first.com'},
|
|
200
|
-
{isLink: false, text: ' other text '},
|
|
201
|
-
{isLink: true, text: 'second link', linkHref: 'https://second.com'},
|
|
202
|
-
]);
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
it('handles a string with adjacent markdown links', () => {
|
|
206
|
-
expect(Util.splitMarkdownLink('start text [first link](https://first.com)[second link](https://second.com) and scene')).toEqual([
|
|
207
|
-
{isLink: false, text: 'start text '},
|
|
208
|
-
{isLink: true, text: 'first link', linkHref: 'https://first.com'},
|
|
209
|
-
{isLink: true, text: 'second link', linkHref: 'https://second.com'},
|
|
210
|
-
{isLink: false, text: ' and scene'},
|
|
211
|
-
]);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
});
|