Skip to content

Commit 4b4ec0e

Browse files
committed
Eslint fix
1 parent 57890d8 commit 4b4ec0e

9 files changed

Lines changed: 428 additions & 180 deletions

File tree

packages/app/src/components/sidebar/explorer.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ import type {
1717
TestRunDetail
1818
} from './types.js'
1919
import { TestState } from './types.js'
20-
import { DEFAULT_CAPABILITIES, FRAMEWORK_CAPABILITIES, STATE_MAP } from './constants.js'
20+
import {
21+
DEFAULT_CAPABILITIES,
22+
FRAMEWORK_CAPABILITIES,
23+
STATE_MAP
24+
} from './constants.js'
2125

2226
import '~icons/mdi/play.js'
2327
import '~icons/mdi/stop.js'

packages/app/src/components/workbench/metadata.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,21 @@ export class DevtoolsMetadata extends Element {
3535

3636
const m = this.metadata as any
3737
const sessionInfo: Record<string, unknown> = {}
38-
if (m.sessionId) sessionInfo['Session ID'] = m.sessionId
39-
if (m.testEnv) sessionInfo['Environment'] = m.testEnv
40-
if (m.host) sessionInfo['WebDriver Host'] = m.host
41-
if (m.modulePath) sessionInfo['Test File'] = m.modulePath
42-
if (m.url) sessionInfo['URL'] = m.url
38+
if (m.sessionId) {
39+
sessionInfo['Session ID'] = m.sessionId
40+
}
41+
if (m.testEnv) {
42+
sessionInfo.Environment = m.testEnv
43+
}
44+
if (m.host) {
45+
sessionInfo['WebDriver Host'] = m.host
46+
}
47+
if (m.modulePath) {
48+
sessionInfo['Test File'] = m.modulePath
49+
}
50+
if (m.url) {
51+
sessionInfo.URL = m.url
52+
}
4353

4454
const caps = m.capabilities || {}
4555
const desiredCaps = m.desiredCapabilities || {}

packages/app/src/controller/DataManager.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ export const isTestRunningContext = createContext<boolean>(
4949
)
5050

5151
interface SocketMessage<
52-
T extends keyof TraceLog | 'testStopped' | 'clearExecutionData' | 'replaceCommand' =
52+
T extends
53+
| keyof TraceLog
54+
| 'testStopped'
55+
| 'clearExecutionData'
56+
| 'replaceCommand' =
5357
| keyof TraceLog
5458
| 'testStopped'
5559
| 'clearExecutionData'
@@ -290,7 +294,10 @@ export class DataManagerController implements ReactiveController {
290294

291295
// Handle in-place command replacement (retry deduplication)
292296
if (scope === 'replaceCommand') {
293-
const { oldTimestamp, command } = data as { oldTimestamp: number; command: CommandLog }
297+
const { oldTimestamp, command } = data as {
298+
oldTimestamp: number
299+
command: CommandLog
300+
}
294301
this.#handleReplaceCommand(oldTimestamp, command)
295302
this.#host.requestUpdate()
296303
return

packages/nightwatch-devtools/src/helpers/browserProxy.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
*/
55

66
import logger from '@wdio/logger'
7-
import { INTERNAL_COMMANDS_TO_IGNORE, BOOLEAN_COMMAND_PATTERN } from '../constants.js'
7+
import {
8+
INTERNAL_COMMANDS_TO_IGNORE,
9+
BOOLEAN_COMMAND_PATTERN
10+
} from '../constants.js'
811
import { getCallSourceFromStack } from './utils.js'
912
import type { SessionCapturer } from '../session.js'
1013
import type { TestManager } from './testManager.js'
@@ -239,9 +242,12 @@ export class BrowserProxy {
239242
passed: false,
240243
actual: callbackResult.actual,
241244
expected: callbackResult.expected,
242-
message: callbackResult.message,
245+
message: callbackResult.message
243246
}
244-
} else if (typeof callbackResult === 'object' && 'value' in callbackResult) {
247+
} else if (
248+
typeof callbackResult === 'object' &&
249+
'value' in callbackResult
250+
) {
245251
const raw = callbackResult.value
246252
// Boolean-semantic command returning null → timed out / not found → false
247253
serializedResult = raw === null && isBooleanCommand ? false : raw

packages/nightwatch-devtools/src/helpers/suiteManager.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,16 @@ export class SuiteManager {
119119
suite.tests.some((t: any) => t.state === TEST_STATE.FAILED) ||
120120
suite.suites.some((s) => s.state === TEST_STATE.FAILED)
121121
const allPassed =
122-
suite.tests.every((t: any) => t.state === TEST_STATE.PASSED || t.state === TEST_STATE.SKIPPED) &&
123-
suite.suites.every((s) => s.state === TEST_STATE.PASSED || s.state === TEST_STATE.SKIPPED)
124-
const hasSkipped = suite.tests.some((t: any) => t.state === TEST_STATE.SKIPPED)
122+
suite.tests.every(
123+
(t: any) =>
124+
t.state === TEST_STATE.PASSED || t.state === TEST_STATE.SKIPPED
125+
) &&
126+
suite.suites.every(
127+
(s) => s.state === TEST_STATE.PASSED || s.state === TEST_STATE.SKIPPED
128+
)
129+
const hasSkipped = suite.tests.some(
130+
(t: any) => t.state === TEST_STATE.SKIPPED
131+
)
125132
const hasItems = suite.tests.length > 0 || suite.suites.length > 0
126133

127134
if (hasFailures) {

packages/nightwatch-devtools/src/helpers/utils.ts

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import type { ConsoleLog, LogLevel, NightwatchTestCase } from '../types.js'
77
export function determineTestState(
88
testcase: NightwatchTestCase
99
): 'passed' | 'failed' | 'skipped' {
10-
if (testcase.passed === 0 && testcase.failed === 0) return 'skipped'
10+
if (testcase.passed === 0 && testcase.failed === 0) {
11+
return 'skipped'
12+
}
1113
return testcase.passed > 0 && testcase.failed === 0 ? 'passed' : 'failed'
1214
}
1315

@@ -20,7 +22,11 @@ const signatureCounters = new Map<string, number>()
2022
*/
2123
export function generateStableUid(itemOrFile: any, name?: string): string {
2224
let file: string, testName: string
23-
if (typeof itemOrFile === 'object' && itemOrFile !== null && name === undefined) {
25+
if (
26+
typeof itemOrFile === 'object' &&
27+
itemOrFile !== null &&
28+
name === undefined
29+
) {
2430
file = itemOrFile.file || ''
2531
testName = String(itemOrFile.fullTitle || itemOrFile.title)
2632
} else {
@@ -235,15 +241,18 @@ export function findTestFileByName(
235241
/**
236242
* Strip ANSI escape codes from a string.
237243
*/
238-
export const stripAnsiCodes = (text: string): string => text.replace(ANSI_REGEX, '')
244+
export const stripAnsiCodes = (text: string): string =>
245+
text.replace(ANSI_REGEX, '')
239246

240247
/**
241248
* Infer a log level from the text content of a line.
242249
*/
243250
export function detectLogLevel(text: string): LogLevel {
244251
const low = stripAnsiCodes(text).toLowerCase()
245252
for (const { level, pattern } of LOG_LEVEL_PATTERNS) {
246-
if (pattern.test(low)) return level
253+
if (pattern.test(low)) {
254+
return level
255+
}
247256
}
248257
return 'log'
249258
}
@@ -267,11 +276,16 @@ export function chromeLogLevelToLogLevel(
267276
): LogLevel {
268277
const s = typeof level === 'object' ? (level?.name ?? '') : (level ?? '')
269278
switch (s.toUpperCase()) {
270-
case 'SEVERE': return 'error'
271-
case 'WARNING': return 'warn'
272-
case 'INFO': return 'info'
273-
case 'DEBUG': return 'debug'
274-
default: return 'log'
279+
case 'SEVERE':
280+
return 'error'
281+
case 'WARNING':
282+
return 'warn'
283+
case 'INFO':
284+
return 'info'
285+
case 'DEBUG':
286+
return 'debug'
287+
default:
288+
return 'log'
275289
}
276290
}
277291

@@ -281,16 +295,38 @@ export function chromeLogLevelToLogLevel(
281295
export function getRequestType(url: string, mimeType?: string): string {
282296
const ct = mimeType?.toLowerCase() ?? ''
283297
const u = url.toLowerCase()
284-
if (ct.includes('text/html')) return 'document'
285-
if (ct.includes('text/css')) return 'stylesheet'
286-
if (ct.includes('javascript') || ct.includes('ecmascript')) return 'script'
287-
if (ct.includes('image/')) return 'image'
288-
if (ct.includes('font/') || ct.includes('woff')) return 'font'
289-
if (ct.includes('application/json')) return 'fetch'
290-
if (u.endsWith('.html') || u.endsWith('.htm')) return 'document'
291-
if (u.endsWith('.css')) return 'stylesheet'
292-
if (u.endsWith('.js') || u.endsWith('.mjs')) return 'script'
293-
if (u.match(/\.(png|jpg|jpeg|gif|svg|webp|ico)$/)) return 'image'
294-
if (u.match(/\.(woff|woff2|ttf|eot|otf)$/)) return 'font'
298+
if (ct.includes('text/html')) {
299+
return 'document'
300+
}
301+
if (ct.includes('text/css')) {
302+
return 'stylesheet'
303+
}
304+
if (ct.includes('javascript') || ct.includes('ecmascript')) {
305+
return 'script'
306+
}
307+
if (ct.includes('image/')) {
308+
return 'image'
309+
}
310+
if (ct.includes('font/') || ct.includes('woff')) {
311+
return 'font'
312+
}
313+
if (ct.includes('application/json')) {
314+
return 'fetch'
315+
}
316+
if (u.endsWith('.html') || u.endsWith('.htm')) {
317+
return 'document'
318+
}
319+
if (u.endsWith('.css')) {
320+
return 'stylesheet'
321+
}
322+
if (u.endsWith('.js') || u.endsWith('.mjs')) {
323+
return 'script'
324+
}
325+
if (u.match(/\.(png|jpg|jpeg|gif|svg|webp|ico)$/)) {
326+
return 'image'
327+
}
328+
if (u.match(/\.(woff|woff2|ttf|eot|otf)$/)) {
329+
return 'font'
330+
}
295331
return 'xhr'
296332
}

0 commit comments

Comments
 (0)