Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use fs.execFile instead of exec #2110

Merged
merged 3 commits into from
Dec 23, 2024
Merged
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions test/pkg/pkg.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { promisify } = require('node:util')
const { unlink } = require('node:fs/promises')
const { join } = require('node:path')
const { platform } = require('node:process')
const exec = promisify(require('node:child_process').exec)
const execFile = promisify(require('node:child_process').execFile)

/**
* The following regex is for tesintg the deprecation warning that is thrown by the `punycode` module.
Expand All @@ -24,7 +24,7 @@ test('worker test when packaged into executable using pkg', { skip: !!process.en
// package the app into several node versions, check config for more info
const filePath = `${join(__dirname, packageName)}.js`
const configPath = join(__dirname, 'pkg.config.json')
const { stderr } = await exec(`npx pkg ${filePath} --config ${configPath}`)
const { stderr } = await execFile('npx', ['pkg', filePath, '--config', configPath])

// there should be no error when packaging
const expectedvalue = stderr === '' || deprecationWarningRegex.test(stderr)
Expand All @@ -42,7 +42,7 @@ test('worker test when packaged into executable using pkg', { skip: !!process.en
executablePath = `./${executablePath}`
}

const { stderr } = await exec(executablePath)
const { stderr } = await execFile(executablePath)

// check if there were no errors
const expectedvalue = stderr === '' || deprecationWarningRegex.test(stderr)
Expand Down
Loading