diff --git a/README.md b/README.md index a79da49..9e2cbef 100644 --- a/README.md +++ b/README.md @@ -872,4 +872,4 @@ tach http://example.com | `--trace` | `false` | Enable performance tracing ([details](#performance-traces)) | | `--trace-log-dir` | `${cwd}/logs` | The directory to put tracing log files. Defaults to `${cwd}/logs`. | | `--trace-cat` | [default categories](./src/defaults.ts) | The tracing categories to record. Should be a string of comma-separated category names | -| `--partition` | _(none)_ | Use `"measurement"` to partition a single large results table into multiple tables for each [measurement](#measurement-modes). | +| `--partition` | `"none"` | Use `"measurement"` to partition a single large results table into multiple tables for each [measurement](#measurement-modes). | diff --git a/src/config.ts b/src/config.ts index 7e8d3a8..90e42bc 100644 --- a/src/config.ts +++ b/src/config.ts @@ -36,7 +36,7 @@ export interface Config { forceCleanNpmInstall: boolean; csvFileStats: string; csvFileRaw: string; - partition?: 'measurement'; + partition: 'none' | 'measurement'; } export async function makeConfig(opts: Opts): Promise { @@ -176,7 +176,8 @@ export function applyDefaults(partial: Partial): Config { : defaults.resolveBareModules, root: partial.root !== undefined ? partial.root : defaults.root, timeout: partial.timeout !== undefined ? partial.timeout : defaults.timeout, - partition: partial.partition, + partition: + partial.partition !== undefined ? partial.partition : defaults.partition, }; } diff --git a/src/configfile.ts b/src/configfile.ts index 4970562..d6a321a 100644 --- a/src/configfile.ts +++ b/src/configfile.ts @@ -387,9 +387,12 @@ export async function parseConfigFile( } if (validated.partition !== undefined) { - if (validated.partition !== 'measurement') { + if ( + validated.partition !== 'measurement' && + validated.partition !== 'none' + ) { throw new Error( - `The "partition" setting only accepts "measurement" as an option.` + `The "partition" setting only accepts "measurement" or "none" as an option.` ); } } diff --git a/src/defaults.ts b/src/defaults.ts index b9a3edd..557268b 100644 --- a/src/defaults.ts +++ b/src/defaults.ts @@ -20,7 +20,7 @@ export const mode = 'automatic'; export const resolveBareModules = true; export const forceCleanNpmInstall = false; export const measurementExpression = 'window.tachometerResult'; -export const partition = ''; +export const partition = 'none'; export const traceLogDir = path.join(process.cwd(), 'logs'); export const traceCategories = [ 'blink', diff --git a/src/test/config_test.ts b/src/test/config_test.ts index ab081f4..1d185bd 100644 --- a/src/test/config_test.ts +++ b/src/test/config_test.ts @@ -45,7 +45,7 @@ suite('makeConfig', function () { csvFileStats: '', csvFileRaw: '', githubCheck: undefined, - partition: undefined, + partition: 'none', benchmarks: [ { browser: { @@ -91,7 +91,7 @@ suite('makeConfig', function () { csvFileRaw: '', // TODO(aomarks) Be consistent about undefined vs unset. githubCheck: undefined, - partition: undefined, + partition: 'none', benchmarks: [ { browser: { @@ -137,7 +137,7 @@ suite('makeConfig', function () { csvFileStats: '', csvFileRaw: '', githubCheck: undefined, - partition: undefined, + partition: 'none', benchmarks: [ { browser: { @@ -190,7 +190,7 @@ suite('makeConfig', function () { remoteAccessibleHost: '', // TODO(aomarks) Be consistent about undefined vs unset. githubCheck: undefined, - partition: undefined, + partition: 'none', benchmarks: [ { browser: { @@ -224,7 +224,7 @@ suite('makeConfig', function () { const expected: Config = { mode: 'automatic', csvFileStats: '', - partition: undefined, + partition: 'none', csvFileRaw: '', jsonFile: '', legacyJsonFile: '', diff --git a/src/test/format_test.ts b/src/test/format_test.ts index 6c4632b..511ad78 100644 --- a/src/test/format_test.ts +++ b/src/test/format_test.ts @@ -227,7 +227,7 @@ suite('format', () => { assert.equal(actual, expected.trim() + '\n'); }); - test('multiple measurements, partition: undefined', async () => { + test('multiple measurements, partition: "none"', async () => { const config: ConfigFile = { benchmarks: [ {