Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion static/local-js/900-kometa.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ document.getElementById('opt-schema-path')?.addEventListener('input', rebuildRun
const checkboxFlags = [
'delete-collections', 'delete-labels', 'read-only-config', 'low-priority',
'no-report', 'no-missing', 'no-countdown', 'ignore-ghost',
'ignore-schedules', 'no-verify-ssl', 'tests'
'ignore-schedules', 'no-verify-ssl', 'tests', 'timings'
]

checkboxFlags.forEach(opt => {
Expand Down
6 changes: 5 additions & 1 deletion static/local-js/modules/kometa/_cliFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export const KOMETA_CLI_FLAGS = Object.freeze({
label: 'Run Tests',
description: 'If you set this flag to true, Kometa will run only collections that you have marked as test immediately, like KOMETA_RUN.<br><strong>NOTE</strong>:<br>This will only run collections with <code>test: true</code> in the definition.'
},
'--timings': {
label: 'Timings',
description: 'Run with timing instrumentation enabled. Kometa writes a timings summary and a JSON/CSV breakdown to the logs directory.<br><strong>NOTE</strong>:<br>Kometa builds from before July 2026 ignore this flag, and builds from before mid-October 2026 can crash on startup with it. Update Kometa before enabling it.'
},
'--timeout': {
label: 'Timeout',
description: 'Change the timeout in seconds for all non-Plex services (such as TMDb, Radarr, and Trakt). This will default to <code>180</code> when not specified and is overwritten by any timeouts mentioned for specific services in the Configuration File.'
Expand Down Expand Up @@ -193,7 +197,7 @@ const OTHER_FLAGS = [
'--mode',
'--delete-collections', '--delete-labels', '--read-only-config', '--low-priority',
'--no-report', '--no-missing', '--no-countdown', '--ignore-ghost',
'--ignore-schedules', '--no-verify-ssl', '--tests', '--timeout', '--divider', '--width'
'--ignore-schedules', '--no-verify-ssl', '--tests', '--timings', '--timeout', '--divider', '--width'
]

/**
Expand Down
2 changes: 1 addition & 1 deletion static/local-js/modules/kometa/_headerBadges.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export function updateOtherFlagsHeaderBadge () {
const coreCount = [
'delete-collections', 'delete-labels', 'read-only-config', 'low-priority',
'no-report', 'no-missing', 'no-countdown', 'ignore-ghost',
'ignore-schedules', 'no-verify-ssl', 'tests'
'ignore-schedules', 'no-verify-ssl', 'tests', 'timings'
].filter(opt => isChecked(`opt-${opt}`)).length
const extrasCount = (isChecked('opt-timeout') ? 1 : 0) +
(isChecked('opt-divider') ? 1 : 0) +
Expand Down
2 changes: 1 addition & 1 deletion static/local-js/modules/kometa/_runCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export function clearActiveRunCommandState () {
const CHECKBOX_FLAGS = [
'delete-collections', 'delete-labels', 'read-only-config', 'low-priority',
'no-report', 'no-missing', 'no-countdown', 'ignore-ghost',
'ignore-schedules', 'no-verify-ssl', 'tests'
'ignore-schedules', 'no-verify-ssl', 'tests', 'timings'
]

/**
Expand Down
2 changes: 1 addition & 1 deletion templates/900-kometa.html
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ <h2 class="accordion-header" id="heading-otherflags">
<fieldset>
<div class="row">
{% for opt in ["delete-collections", "delete-labels", "read-only-config", "low-priority", "no-report",
"no-missing", "no-countdown", "ignore-ghost", "ignore-schedules", "no-verify-ssl", "tests"] %}
"no-missing", "no-countdown", "ignore-ghost", "ignore-schedules", "no-verify-ssl", "tests", "timings"] %}
<div class="col-md-4">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="opt-{{ opt }}" value="--{{ opt }}">
Expand Down
15 changes: 14 additions & 1 deletion tests/js/kometa/cliFlags.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('KOMETA_CLI_FLAGS', () => {
'--delete-collections', '--delete-labels', '--read-only-config',
'--low-priority', '--no-report', '--no-missing', '--no-countdown',
'--ignore-ghost', '--ignore-schedules', '--no-verify-ssl',
'--tests', '--timeout', '--divider', '--width'
'--tests', '--timings', '--timeout', '--divider', '--width'
]
expect(Object.keys(KOMETA_CLI_FLAGS).sort()).toEqual(expected.sort())
})
Expand Down Expand Up @@ -93,6 +93,7 @@ describe('updateFlagLabels', () => {
<label for="opt-operations-only">placeholder</label>
<label for="opt-validate">placeholder</label>
<label for="opt-no-verify-ssl">placeholder</label>
<label for="opt-timings">placeholder</label>
`
})

Expand Down Expand Up @@ -163,6 +164,18 @@ describe('updateFlagLabels', () => {
expect(document.querySelector('label[for="opt-no-verify-ssl"]').textContent).toContain('No Verify SSL')
})

it('shows the --timings help in both friendly-label and CLI-label modes', () => {
for (const showCli of [false, true]) {
updateFlagLabels(showCli)
const label = document.querySelector('label[for="opt-timings"]')
expect(label.textContent).toContain(showCli ? '--timings' : 'Timings')
expect(label.innerHTML).toContain('data-bs-toggle="tooltip"')
expect(label.innerHTML).toContain('before July 2026 ignore this flag')
expect(label.innerHTML).toContain('before mid-October 2026 can crash on startup')
expect(label.innerHTML).toContain('Update Kometa before enabling it')
}
})

it('produces info-icon markup regardless of showCli', () => {
updateFlagLabels(false)
const friendly = document.querySelector('label[for="opt-run"]').innerHTML
Expand Down
15 changes: 11 additions & 4 deletions tests/js/kometa/headerBadges.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ describe('updateOtherFlagsHeaderBadge', () => {
const flags = [
'delete-collections', 'delete-labels', 'read-only-config', 'low-priority',
'no-report', 'no-missing', 'no-countdown', 'ignore-ghost',
'ignore-schedules', 'no-verify-ssl', 'tests',
'ignore-schedules', 'no-verify-ssl', 'tests', 'timings',
'timeout', 'divider', 'width'
]
const html = flags.map(f =>
Expand Down Expand Up @@ -537,18 +537,25 @@ describe('updateOtherFlagsHeaderBadge', () => {
expect(badge.textContent).toBe('3 enabled')
})

it('counts all 11 core flags + 3 extras when everything is on', () => {
it('counts all 12 core flags + 3 extras when everything is on', () => {
// Full-house: verifies the two counting paths sum correctly
installOtherFlagsDom({
'delete-collections': true, 'delete-labels': true, 'read-only-config': true,
'low-priority': true, 'no-report': true, 'no-missing': true,
'no-countdown': true, 'ignore-ghost': true, 'ignore-schedules': true,
'no-verify-ssl': true, tests: true,
'no-verify-ssl': true, tests: true, timings: true,
timeout: true, divider: true, width: true
})
updateOtherFlagsHeaderBadge()
const badge = document.getElementById('heading-otherflags-rollup-badge')
expect(badge.textContent).toBe('14 enabled')
expect(badge.textContent).toBe('15 enabled')
})

it('counts the timings flag', () => {
installOtherFlagsDom({ timings: true })
updateOtherFlagsHeaderBadge()
const badge = document.getElementById('heading-otherflags-rollup-badge')
expect(badge.textContent).toBe('1 enabled')
})
})

Expand Down
23 changes: 23 additions & 0 deletions tests/js/kometa/runCommand.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function installRunCommandDom (opts = {}) {
<input type="checkbox" id="opt-ignore-schedules">
<input type="checkbox" id="opt-no-verify-ssl">
<input type="checkbox" id="opt-tests">
<input type="checkbox" id="opt-timings">

<input type="checkbox" id="opt-timeout">
<input id="opt-timeout-val" value="">
Expand Down Expand Up @@ -536,6 +537,28 @@ describe('buildCommand no-value checkboxes', () => {
expect(out).not.toContain('--tests')
})

it('appends --timings when ticked and leaves it out when not', () => {
installRunCommandDom()
const out = () => document.getElementById('run-command-output').dataset.builtCommand
buildCommand()
expect(out()).not.toContain('--timings')
document.getElementById('opt-timings').checked = true
buildCommand()
expect(out()).toContain('--timings')
})

it('rebuilds the command when the --timings checkbox is toggled', () => {
installRunCommandDom()
const box = document.getElementById('opt-timings')
const out = () => document.getElementById('run-command-output').dataset.builtCommand
box.checked = true
buildCommand()
expect(out()).toContain('--timings')
box.checked = false
buildCommand()
expect(out()).not.toContain('--timings')
})

it('is silent when a checkbox element is missing (no throw)', () => {
installRunCommandDom()
document.getElementById('opt-tests').remove()
Expand Down
Loading