diff --git a/static/local-js/900-kometa.js b/static/local-js/900-kometa.js index 6ab627bf..e4fd618d 100644 --- a/static/local-js/900-kometa.js +++ b/static/local-js/900-kometa.js @@ -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 => { diff --git a/static/local-js/modules/kometa/_cliFlags.js b/static/local-js/modules/kometa/_cliFlags.js index 2a697efb..b3ed8d5c 100644 --- a/static/local-js/modules/kometa/_cliFlags.js +++ b/static/local-js/modules/kometa/_cliFlags.js @@ -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.
NOTE:
This will only run collections with test: true 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.
NOTE:
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 180 when not specified and is overwritten by any timeouts mentioned for specific services in the Configuration File.' @@ -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' ] /** diff --git a/static/local-js/modules/kometa/_headerBadges.js b/static/local-js/modules/kometa/_headerBadges.js index 5440b350..fd0bde3e 100644 --- a/static/local-js/modules/kometa/_headerBadges.js +++ b/static/local-js/modules/kometa/_headerBadges.js @@ -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) + diff --git a/static/local-js/modules/kometa/_runCommand.js b/static/local-js/modules/kometa/_runCommand.js index 6df31824..f9ee1a7e 100644 --- a/static/local-js/modules/kometa/_runCommand.js +++ b/static/local-js/modules/kometa/_runCommand.js @@ -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' ] /** diff --git a/templates/900-kometa.html b/templates/900-kometa.html index 7bdca594..6921f9c6 100644 --- a/templates/900-kometa.html +++ b/templates/900-kometa.html @@ -795,7 +795,7 @@

{% 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"] %}
diff --git a/tests/js/kometa/cliFlags.test.js b/tests/js/kometa/cliFlags.test.js index 4c6ee9b1..96066be3 100644 --- a/tests/js/kometa/cliFlags.test.js +++ b/tests/js/kometa/cliFlags.test.js @@ -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()) }) @@ -93,6 +93,7 @@ describe('updateFlagLabels', () => { + ` }) @@ -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 diff --git a/tests/js/kometa/headerBadges.test.js b/tests/js/kometa/headerBadges.test.js index 00e39cdf..3e3d76d2 100644 --- a/tests/js/kometa/headerBadges.test.js +++ b/tests/js/kometa/headerBadges.test.js @@ -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 => @@ -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') }) }) diff --git a/tests/js/kometa/runCommand.test.js b/tests/js/kometa/runCommand.test.js index f994bf93..61f8e8b7 100644 --- a/tests/js/kometa/runCommand.test.js +++ b/tests/js/kometa/runCommand.test.js @@ -124,6 +124,7 @@ function installRunCommandDom (opts = {}) { + @@ -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()