|
4 | 4 | * SPDX-License-Identifier: Apache-2.0 |
5 | 5 | */ |
6 | 6 |
|
7 | | -import jestMock from 'jest-mock'; |
8 | | - |
9 | 7 | import {Audit as BaseAudit} from '../../audits/audit.js'; |
10 | 8 | import BaseGatherer from '../../gather/base-gatherer.js'; |
11 | 9 | import {initializeConfig, getConfigDisplayString} from '../../config/config.js'; |
12 | 10 | import {LH_ROOT} from '../../../shared/root.js'; |
13 | 11 | import * as format from '../../../shared/localization/format.js'; |
14 | 12 | import defaultConfig from '../../config/default-config.js'; |
15 | 13 | import {nonSimulatedSettingsOverrides} from '../../config/constants.js'; |
| 14 | +import {fnAny} from '../test-utils.js'; |
16 | 15 |
|
17 | 16 | describe('Config', () => { |
18 | 17 | /** @type {LH.Gatherer.GatherMode} */ |
@@ -106,14 +105,14 @@ describe('Config', () => { |
106 | 105 |
|
107 | 106 | it('should throw on invalid artifact definitions', async () => { |
108 | 107 | const badGatherer = new BaseGatherer(); |
109 | | - badGatherer.getArtifact = jestMock.fn(); |
| 108 | + badGatherer.getArtifact = fnAny(); |
110 | 109 | const config = {artifacts: [{id: 'BadGatherer', gatherer: {instance: badGatherer}}]}; |
111 | 110 | await expect(initializeConfig(gatherMode, config)).rejects.toThrow(/Gatherer for BadGather/); |
112 | 111 | }); |
113 | 112 |
|
114 | 113 | it('should filter configuration by gatherMode', async () => { |
115 | 114 | const timespanGatherer = new BaseGatherer(); |
116 | | - timespanGatherer.getArtifact = jestMock.fn(); |
| 115 | + timespanGatherer.getArtifact = fnAny(); |
117 | 116 | timespanGatherer.meta = {supportedModes: ['timespan']}; |
118 | 117 |
|
119 | 118 | const config = { |
@@ -186,11 +185,11 @@ describe('Config', () => { |
186 | 185 | beforeEach(() => { |
187 | 186 | const dependencySymbol = Symbol('dependency'); |
188 | 187 | dependencyGatherer = new BaseGatherer(); |
189 | | - dependencyGatherer.getArtifact = jestMock.fn(); |
| 188 | + dependencyGatherer.getArtifact = fnAny(); |
190 | 189 | dependencyGatherer.meta = {symbol: dependencySymbol, supportedModes: ['snapshot']}; |
191 | 190 | // @ts-expect-error - we satisfy the interface on the next line |
192 | 191 | dependentGatherer = new BaseGatherer(); |
193 | | - dependentGatherer.getArtifact = jestMock.fn(); |
| 192 | + dependentGatherer.getArtifact = fnAny(); |
194 | 193 | dependentGatherer.meta = { |
195 | 194 | supportedModes: ['snapshot'], |
196 | 195 | dependencies: {ImageElements: dependencySymbol}, |
@@ -250,7 +249,7 @@ describe('Config', () => { |
250 | 249 |
|
251 | 250 | beforeEach(() => { |
252 | 251 | const gatherer = new BaseGatherer(); |
253 | | - gatherer.getArtifact = jestMock.fn(); |
| 252 | + gatherer.getArtifact = fnAny(); |
254 | 253 | gatherer.meta = {supportedModes: ['navigation']}; |
255 | 254 |
|
256 | 255 | class ExtraAudit extends BaseAudit { |
|
0 commit comments