Skip to content

Commit

Permalink
add "none" as the default value.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewJakubowicz committed Nov 28, 2023
1 parent 2bb8bcf commit 7d707cd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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). |
5 changes: 3 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Config> {
Expand Down Expand Up @@ -176,7 +176,8 @@ export function applyDefaults(partial: Partial<Config>): 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,
};
}

Expand Down
7 changes: 5 additions & 2 deletions src/configfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 5 additions & 5 deletions src/test/config_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ suite('makeConfig', function () {
csvFileStats: '',
csvFileRaw: '',
githubCheck: undefined,
partition: undefined,
partition: 'none',
benchmarks: [
{
browser: {
Expand Down Expand Up @@ -91,7 +91,7 @@ suite('makeConfig', function () {
csvFileRaw: '',
// TODO(aomarks) Be consistent about undefined vs unset.
githubCheck: undefined,
partition: undefined,
partition: 'none',
benchmarks: [
{
browser: {
Expand Down Expand Up @@ -137,7 +137,7 @@ suite('makeConfig', function () {
csvFileStats: '',
csvFileRaw: '',
githubCheck: undefined,
partition: undefined,
partition: 'none',
benchmarks: [
{
browser: {
Expand Down Expand Up @@ -190,7 +190,7 @@ suite('makeConfig', function () {
remoteAccessibleHost: '',
// TODO(aomarks) Be consistent about undefined vs unset.
githubCheck: undefined,
partition: undefined,
partition: 'none',
benchmarks: [
{
browser: {
Expand Down Expand Up @@ -224,7 +224,7 @@ suite('makeConfig', function () {
const expected: Config = {
mode: 'automatic',
csvFileStats: '',
partition: undefined,
partition: 'none',
csvFileRaw: '',
jsonFile: '',
legacyJsonFile: '',
Expand Down
2 changes: 1 addition & 1 deletion src/test/format_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down

0 comments on commit 7d707cd

Please sign in to comment.