Skip to content

Commit

Permalink
chore: enable verbose mode for all execa calls
Browse files Browse the repository at this point in the history
  • Loading branch information
serhalp committed Dec 9, 2024
1 parent 88d1646 commit ae6fd7a
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ava.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as execa from 'execa'

const { execaCommand } = execa
if (process.argv.includes('-w')) {
execaCommand('tsc -w', { cleanup: true })
execaCommand('tsc -w', { cleanup: true, verbose: 'full' })
}

// `tests-metadata.json` is created by running `npx lerna run test:measure --scope @netlify/build`
Expand Down
2 changes: 1 addition & 1 deletion packages/build-info/tests/bin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const runBinary = (...args: string[]) => {
return execaNode(binary, args)
}
const binary = fileURLToPath(new URL('../src/node/bin.ts', import.meta.url))
return execa('node', ['--loader=ts-node/esm', '--no-warnings', binary, ...args])
return execa('node', ['--loader=ts-node/esm', '--no-warnings', binary, ...args], { verbose: 'full' })
}

test('CLI --help flag', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/build/src/core/user_node_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const getUserNodeVersion = async function (nodePath) {
}

// Fallback to actually running `node --version` with the given nodePath
const { stdout } = await execa(nodePath, ['--version'], { reject: false })
const { stdout } = await execa(nodePath, ['--version'], { reject: false, verbose: 'full' })
const version = semver.clean(stdout)

if (version === null) {
Expand Down
2 changes: 1 addition & 1 deletion packages/build/src/install/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const addExactDependencies = function ({ packageRoot, isLocal, packages }
const runCommand = async function ({ packageRoot, packages = [], isLocal, type }) {
try {
const [command, ...args] = await getCommand({ packageRoot, type, isLocal })
await execa(command, [...args, ...packages], { cwd: packageRoot, all: true })
await execa(command, [...args, ...packages], { cwd: packageRoot, all: true, verbose: 'full' })
} catch (error) {
const message = getErrorMessage(error.all)
const errorA = new Error(`Error while installing dependencies in ${packageRoot}\n${message}`)
Expand Down
2 changes: 1 addition & 1 deletion packages/build/src/install/missing.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const getIntegrationPackage = async function ({
const integrationDir = testOpts.cwd ? resolve(testOpts.cwd, path) : resolve(buildDir, path)

try {
const res = await execa('npm', ['run', 'build'], { cwd: integrationDir, env: pluginsEnv })
const res = await execa('npm', ['run', 'build'], { cwd: integrationDir, env: pluginsEnv, verbose: 'full' })

// This is horrible and hacky, but `npm run build` will
// return status code 0 even if it fails
Expand Down
1 change: 1 addition & 0 deletions packages/build/src/plugins_core/build_command.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const coreStep = async function ({
env: childEnv,
extendEnv: false,
stdio,
verbose: 'full',
})

try {
Expand Down
2 changes: 1 addition & 1 deletion packages/build/tests/plugins/fixtures/local_bin/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { execa } from 'execa'

export const onPreBuild = async function () {
await execa('atob', ['dGVzdA=='], { stdio: 'inherit' })
await execa('atob', ['dGVzdA=='], { stdio: 'inherit', verbose: 'full' })
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/config/src/env/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getGitEnv = async function (buildDir, branch) {

const git = async function (args, cwd) {
try {
const { stdout } = await execa('git', args, { cwd })
const { stdout } = await execa('git', args, { cwd, verbose: 'full' })
return stdout
} catch {
// continue regardless error
Expand Down
5 changes: 4 additions & 1 deletion packages/config/src/options/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export const getBranch = async function ({ branch, repositoryRoot }) {

const getGitBranch = async function (repositoryRoot, gitRef) {
try {
const { stdout } = await execaCommand(`git rev-parse --abbrev-ref ${gitRef}`, { cwd: repositoryRoot })
const { stdout } = await execaCommand(`git rev-parse --abbrev-ref ${gitRef}`, {
cwd: repositoryRoot,
verbose: 'full',
})
return stdout
} catch {
// continue regardless error
Expand Down
2 changes: 1 addition & 1 deletion packages/edge-bundler/test/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const inspectFunction = (path: string) => `
responses[functionName] = await res.text();
}
console.log(JSON.stringify(responses));
`

Expand Down
2 changes: 1 addition & 1 deletion packages/run-utils/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import process from 'process'
import { execa, type Subprocess, execaCommand, type Options } from 'execa'

/** Allow running local binaries by default */
const DEFAULT_OPTIONS: Partial<Options> = { preferLocal: true }
const DEFAULT_OPTIONS: Partial<Options> = { preferLocal: true, verbose: 'full' }

/** Run a command, with arguments being an array */
export const run = (file: string, args?: string[] | object, options?: Options) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/src/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class Fixture {
await cpy('./**', this.copyRootDir, { cwd: this.repositoryRoot })

if (copyRoot.branch !== undefined) {
await execaCommand(`git checkout -b ${copyRoot.branch}`, { cwd: this.copyRootDir })
await execaCommand(`git checkout -b ${copyRoot.branch}`, { cwd: this.copyRootDir, verbose: 'full' })
}

this.repositoryRoot = this.copyRootDir
Expand Down
4 changes: 2 additions & 2 deletions packages/testing/src/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const unzipFile = async function (path: string, dest: string): Promise<vo
await mkdir(dest, { recursive: true })

if (platform === 'win32') {
await execa('tar', ['-xf', path, '-C', dest])
await execa('tar', ['-xf', path, '-C', dest]), { verbose: 'full' }
} else {
await execa('unzip', ['-o', path, '-d', dest])
await execa('unzip', ['-o', path, '-d', dest], { verbose: 'full' })
}
}
4 changes: 2 additions & 2 deletions packages/zip-it-and-ship-it/tests/helpers/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ const unzipFile = async function (path: string, dest: string): Promise<void> {
await mkdir(dest, { recursive: true })

if (platform === 'win32') {
await execa('tar', ['-xf', path, '-C', dest])
await execa('tar', ['-xf', path, '-C', dest]), { verbose: 'full' }
} else {
await execa('unzip', ['-o', path, '-d', dest])
await execa('unzip', ['-o', path, '-d', dest], { verbose: 'full' })
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/zip-it-and-ship-it/tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ describe('zip-it-and-ship-it', () => {

await execa('npm', ['install', '--no-package-lock', '--no-audit', '--prefer-offline', '--progress=false'], {
cwd: basePath,
verbose: 'full',
})
}, 30_000)

Expand Down Expand Up @@ -1194,7 +1195,7 @@ describe('zip-it-and-ship-it', () => {
const fixturePath = join(FIXTURES_DIR, 'esbuild-log-limit')

try {
await execa('node', [BINARY_PATH, fixturePath, tmpDir, `--config.*.nodeBundler=esbuild`])
await execa('node', [BINARY_PATH, fixturePath, tmpDir, `--config.*.nodeBundler=esbuild`], { verbose: 'full' })

expect.fail('Bundling should have thrown')
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion tools/tests-duration.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const measureDurations = async () => {
const durations = new Map()
for (const testFile of testFiles) {
const startTime = performance.now()
const { stdout } = await execa('ava', [testFile], { preferLocal: true, reject: false })
const { stdout } = await execa('ava', [testFile], { preferLocal: true, reject: false, verbose: 'full' })
console.log(stdout)
const endTime = performance.now()

Expand Down

0 comments on commit ae6fd7a

Please sign in to comment.