@callstack/reassure-cli
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -17,2 +17,4 @@ "use strict"; | ||
var _git = require("./git"); | ||
const RESULTS_DIRECTORY = '.reassure'; | ||
@@ -22,5 +24,10 @@ const RESULTS_FILE = '.reassure/current.perf'; | ||
function run(options) { | ||
const measurementType = options.baseline ? 'baseline' : 'current'; | ||
console.log(`\n❇️ Running ${measurementType} performance tests:`); | ||
async function run(options) { | ||
const measurementType = options.baseline ? 'Baseline' : 'Current'; | ||
const metadata = { | ||
branch: (options === null || options === void 0 ? void 0 : options.branch) ?? (await (0, _git.getGitBranch)()), | ||
commitHash: (options === null || options === void 0 ? void 0 : options.commitHash) ?? (await (0, _git.getGitCommitHash)()) | ||
}; | ||
console.log(`\n❇️ Running performance tests:`); | ||
console.log(` - ${measurementType}: ${(0, _reassureCompare.formatMetadata)(metadata)}\n`); | ||
(0, _fs.mkdirSync)(RESULTS_DIRECTORY, { | ||
@@ -33,2 +40,6 @@ recursive: true | ||
}); | ||
const header = { | ||
metadata | ||
}; | ||
(0, _fs.writeFileSync)(outputFile, JSON.stringify(header) + '\n'); | ||
const testRunnerPath = process.env.TEST_RUNNER_PATH ?? 'node_modules/.bin/jest'; | ||
@@ -86,2 +97,8 @@ const testRunnerArgs = process.env.TEST_RUNNER_ARGS ?? '--runInBand --testMatch "<rootDir>/**/*.perf-test.[jt]s?(x)"'; | ||
describe: 'Outputs performance comparison results' | ||
}).option('branch', { | ||
type: 'string', | ||
describe: 'Branch name of current code to be included in the report' | ||
}).option('commit-hash', { | ||
type: 'string', | ||
describe: 'Commit hash of current code to be included in the report' | ||
}); | ||
@@ -88,0 +105,0 @@ }, |
@@ -1,11 +0,17 @@ | ||
import { mkdirSync, rmSync, existsSync } from 'fs'; | ||
import { mkdirSync, rmSync, existsSync, writeFileSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
import { spawnSync } from 'child_process'; | ||
import { compare } from '@callstack/reassure-compare'; | ||
import { compare, formatMetadata } from '@callstack/reassure-compare'; | ||
import { getGitBranch, getGitCommitHash } from './git'; | ||
const RESULTS_DIRECTORY = '.reassure'; | ||
const RESULTS_FILE = '.reassure/current.perf'; | ||
const BASELINE_FILE = '.reassure/baseline.perf'; | ||
export function run(options) { | ||
const measurementType = options.baseline ? 'baseline' : 'current'; | ||
console.log(`\n❇️ Running ${measurementType} performance tests:`); | ||
export async function run(options) { | ||
const measurementType = options.baseline ? 'Baseline' : 'Current'; | ||
const metadata = { | ||
branch: (options === null || options === void 0 ? void 0 : options.branch) ?? (await getGitBranch()), | ||
commitHash: (options === null || options === void 0 ? void 0 : options.commitHash) ?? (await getGitCommitHash()) | ||
}; | ||
console.log(`\n❇️ Running performance tests:`); | ||
console.log(` - ${measurementType}: ${formatMetadata(metadata)}\n`); | ||
mkdirSync(RESULTS_DIRECTORY, { | ||
@@ -18,2 +24,6 @@ recursive: true | ||
}); | ||
const header = { | ||
metadata | ||
}; | ||
writeFileSync(outputFile, JSON.stringify(header) + '\n'); | ||
const testRunnerPath = process.env.TEST_RUNNER_PATH ?? 'node_modules/.bin/jest'; | ||
@@ -70,2 +80,8 @@ const testRunnerArgs = process.env.TEST_RUNNER_ARGS ?? '--runInBand --testMatch "<rootDir>/**/*.perf-test.[jt]s?(x)"'; | ||
describe: 'Outputs performance comparison results' | ||
}).option('branch', { | ||
type: 'string', | ||
describe: 'Branch name of current code to be included in the report' | ||
}).option('commit-hash', { | ||
type: 'string', | ||
describe: 'Commit hash of current code to be included in the report' | ||
}); | ||
@@ -72,0 +88,0 @@ }, |
{ | ||
"name": "@callstack/reassure-cli", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Performance testing companion for React and React Native", | ||
@@ -42,7 +42,7 @@ "main": "lib/commonjs/index", | ||
"dependencies": { | ||
"@callstack/reassure-compare": "0.1.1", | ||
"yargs": "^17.5.1" | ||
"@callstack/reassure-compare": "0.2.0", | ||
"simple-git": "^3.14.1", | ||
"yargs": "^17.6.0" | ||
}, | ||
"devDependencies": { | ||
"react-native-builder-bob": "^0.18.0", | ||
"@types/yargs": "^17.0.13" | ||
@@ -49,0 +49,0 @@ }, |
@@ -1,6 +0,8 @@ | ||
import { mkdirSync, rmSync, existsSync } from 'fs'; | ||
import { mkdirSync, rmSync, existsSync, writeFileSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
import { spawnSync } from 'child_process'; | ||
import type { CommandModule } from 'yargs'; | ||
import { compare } from '@callstack/reassure-compare'; | ||
import { compare, formatMetadata } from '@callstack/reassure-compare'; | ||
import type { PerformanceMetadata } from '@callstack/reassure-compare/lib/typescript/types'; | ||
import { getGitBranch, getGitCommitHash } from './git'; | ||
@@ -14,8 +16,17 @@ const RESULTS_DIRECTORY = '.reassure'; | ||
compare?: boolean; | ||
branch?: string; | ||
commitHash?: string; | ||
}; | ||
export function run(options: MeasureOptions) { | ||
const measurementType = options.baseline ? 'baseline' : 'current'; | ||
console.log(`\n❇️ Running ${measurementType} performance tests:`); | ||
export async function run(options: MeasureOptions) { | ||
const measurementType = options.baseline ? 'Baseline' : 'Current'; | ||
const metadata: PerformanceMetadata = { | ||
branch: options?.branch ?? (await getGitBranch()), | ||
commitHash: options?.commitHash ?? (await getGitCommitHash()), | ||
}; | ||
console.log(`\n❇️ Running performance tests:`); | ||
console.log(` - ${measurementType}: ${formatMetadata(metadata)}\n`); | ||
mkdirSync(RESULTS_DIRECTORY, { recursive: true }); | ||
@@ -26,2 +37,5 @@ | ||
const header = { metadata }; | ||
writeFileSync(outputFile, JSON.stringify(header) + '\n'); | ||
const testRunnerPath = process.env.TEST_RUNNER_PATH ?? 'node_modules/.bin/jest'; | ||
@@ -90,2 +104,10 @@ const testRunnerArgs = process.env.TEST_RUNNER_ARGS ?? '--runInBand --testMatch "<rootDir>/**/*.perf-test.[jt]s?(x)"'; | ||
describe: 'Outputs performance comparison results', | ||
}) | ||
.option('branch', { | ||
type: 'string', | ||
describe: 'Branch name of current code to be included in the report', | ||
}) | ||
.option('commit-hash', { | ||
type: 'string', | ||
describe: 'Commit hash of current code to be included in the report', | ||
}); | ||
@@ -92,0 +114,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
38795
1
21
441
3
+ Addedsimple-git@^3.14.1
+ Added@callstack/reassure-compare@0.2.0(transitive)
+ Added@kwsites/file-exists@1.1.1(transitive)
+ Added@kwsites/promise-deferred@1.1.1(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addedms@2.1.3(transitive)
+ Addedsimple-git@3.27.0(transitive)
- Removed@callstack/reassure-compare@0.1.1(transitive)
Updatedyargs@^17.6.0