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
5 changes: 4 additions & 1 deletion packages/ci/src/lib/run-utils.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,8 +69,11 @@ export async function createRunEnv(
options: Options | undefined,
git: SimpleGit,
): Promise<RunEnv> {
const inferredVerbose: boolean = Boolean(
options?.debug === true || options?.silent === false,
);
// eslint-disable-next-line functional/immutable-data
process.env['CP_VERBOSE'] = options?.silent ? 'false' : 'true';
process.env['CP_VERBOSE'] = `${inferredVerbose}`;

const [head, base] = await Promise.all([
normalizeGitRef(refs.head, git),
Expand Down
70 changes: 16 additions & 54 deletions packages/ci/src/lib/run.int.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -250,17 +250,13 @@ describe('runInCI', () => {
expect(utils.executeProcess).toHaveBeenCalledTimes(2);
expect(utils.executeProcess).toHaveBeenNthCalledWith(1, {
command: options.bin,
args: [
'print-config',
'--verbose',
expect.stringMatching(/^--output=.*\.json$/),
],
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: workDir,
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(2, {
command: options.bin,
args: ['--verbose', '--persist.format=json', '--persist.format=md'],
args: ['--persist.format=json', '--persist.format=md'],
cwd: workDir,
observer: expectedObserver,
} satisfies utils.ProcessConfig);
Expand DownExpand Up@@ -332,41 +328,32 @@ describe('runInCI', () => {
expect(utils.executeProcess).toHaveBeenCalledTimes(5);
expect(utils.executeProcess).toHaveBeenNthCalledWith(1, {
command: options.bin,
args: [
'print-config',
'--verbose',
expect.stringMatching(/^--output=.*\.json$/),
],
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: workDir,
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(2, {
command: options.bin,
args: ['--verbose', '--persist.format=json', '--persist.format=md'],
args: ['--persist.format=json', '--persist.format=md'],
cwd: workDir,
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(3, {
command: options.bin,
args: [
'print-config',
'--verbose',
expect.stringMatching(/^--output=.*\.json$/),
],
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: workDir,
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(4, {
command: options.bin,
args: ['--verbose', '--persist.format=json', '--persist.format=md'],
args: ['--persist.format=json', '--persist.format=md'],
cwd: workDir,
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(5, {
command: options.bin,
args: [
'compare',
'--verbose',
`--before=${path.join(outputDir, '.previous/report.json')}`,
`--after=${path.join(outputDir, '.current/report.json')}`,
'--persist.format=json',
Expand DownExpand Up@@ -425,25 +412,20 @@ describe('runInCI', () => {
expect(utils.executeProcess).toHaveBeenCalledTimes(3);
expect(utils.executeProcess).toHaveBeenNthCalledWith(1, {
command: options.bin,
args: [
'print-config',
'--verbose',
expect.stringMatching(/^--output=.*\.json$/),
],
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: workDir,
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(2, {
command: options.bin,
args: ['--verbose', '--persist.format=json', '--persist.format=md'],
args: ['--persist.format=json', '--persist.format=md'],
cwd: workDir,
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(3, {
command: options.bin,
args: [
'compare',
'--verbose',
`--before=${path.join(outputDir, '.previous/report.json')}`,
`--after=${path.join(outputDir, '.current/report.json')}`,
'--persist.format=json',
Expand DownExpand Up@@ -617,17 +599,13 @@ describe('runInCI', () => {
).toHaveLength(4); // 1 autorun for all projects, 3 print-configs for each project
expect(utils.executeProcess).toHaveBeenCalledWith({
command: run,
args: [
'print-config',
'--verbose',
expect.stringMatching(/^--output=.*\.json$/),
],
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: runMany,
args: ['--verbose', '--persist.format=json', '--persist.format=md'],
args: ['--persist.format=json', '--persist.format=md'],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
} satisfies utils.ProcessConfig);
Expand DownExpand Up@@ -779,25 +757,20 @@ describe('runInCI', () => {
).toHaveLength(10);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: run,
args: [
'print-config',
'--verbose',
expect.stringMatching(/^--output=.*\.json$/),
],
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: runMany,
args: ['--verbose', '--persist.format=json', '--persist.format=md'],
args: ['--persist.format=json', '--persist.format=md'],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: run,
args: [
'compare',
'--verbose',
expect.stringMatching(/^--before=.*\.previous[/\\]report\.json$/),
expect.stringMatching(/^--after=.*\.current[/\\]report\.json$/),
expect.stringMatching(/^--label=\w+$/),
Expand All@@ -811,7 +784,6 @@ describe('runInCI', () => {
command: run,
args: [
'merge-diffs',
'--verbose',
expect.stringMatching(
/^--files=.*[/\\]cli[/\\]\.comparison[/\\]report-diff\.json$/,
),
Expand DownExpand Up@@ -973,17 +945,13 @@ describe('runInCI', () => {
).toHaveLength(6); // 3 autoruns and 3 print-configs for each project
expect(utils.executeProcess).toHaveBeenCalledWith({
command: options.bin,
args: [
'print-config',
'--verbose',
expect.stringMatching(/^--output=.*\.json$/),
],
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: options.bin,
args: ['--verbose', '--persist.format=json', '--persist.format=md'],
args: ['--persist.format=json', '--persist.format=md'],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
} satisfies utils.ProcessConfig);
Expand DownExpand Up@@ -1146,25 +1114,20 @@ describe('runInCI', () => {
).toHaveLength(10);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: options.bin,
args: [
'print-config',
'--verbose',
expect.stringMatching(/^--output=.*\.json$/),
],
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: options.bin,
args: ['--verbose', '--persist.format=json', '--persist.format=md'],
args: ['--persist.format=json', '--persist.format=md'],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: options.bin,
args: [
'compare',
'--verbose',
expect.stringMatching(/^--before=.*\.previous[/\\]report\.json$/),
expect.stringMatching(/^--after=.*\.current[/\\]report\.json$/),
expect.stringMatching(/^--label=\w+$/),
Expand All@@ -1178,7 +1141,6 @@ describe('runInCI', () => {
command: options.bin,
args: [
'merge-diffs',
'--verbose',
expect.stringMatching(
/^--files=.*api[/\\]\.comparison[/\\]report-diff\.json$/,
),
Expand Down