From 079b36b06f653cb4e56fbd66bd8b66e2720cc10d Mon Sep 17 00:00:00 2001 From: Christoph Uhland <42832096+cuhland@users.noreply.github.com> Date: Fri, 6 Dec 2024 13:55:05 +0100 Subject: [PATCH 01/14] Create dir if not exists Signed-off-by: Christoph Uhland <42832096+cuhland@users.noreply.github.com> --- src/cli.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 58165f068..feffe7195 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -19,7 +19,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. import { Builders, Enums, Factories, Serialize, Spec, Validation } from '@cyclonedx/cyclonedx-library' import { Argument, Command, Option } from 'commander' -import { existsSync, openSync } from 'fs' +import { existsSync, mkdirSync, openSync } from 'fs' import { dirname, resolve } from 'path' import { loadJsonFile, writeAllSync } from './_helpers' @@ -309,10 +309,14 @@ export async function run (process: NodeJS.Process): Promise { } myConsole.log('LOG | writing BOM to', options.outputFile) + const directory = dirname(options.outputFile) + if (!existsSync(directory)) { + mkdirSync(directory, { recursive: true }) + } const written = await writeAllSync( options.outputFile === OutputStdOut ? process.stdout.fd - : openSync(resolve(process.cwd(), options.outputFile), 'w'), + : openSync(resolve(options.outputFile), 'w'), serialized ) myConsole.info('INFO | wrote %d bytes to %s', written, options.outputFile) From a9f21df27398c59067c627e939a1efe768b83c07 Mon Sep 17 00:00:00 2001 From: Christoph Uhland <42832096+cuhland@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:09:26 +0100 Subject: [PATCH 02/14] Handle review comments - log the directory Signed-off-by: Christoph Uhland <42832096+cuhland@users.noreply.github.com> --- src/cli.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index feffe7195..2ef8341ef 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -307,12 +307,12 @@ export async function run (process: NodeJS.Process): Promise { } } } - - myConsole.log('LOG | writing BOM to', options.outputFile) const directory = dirname(options.outputFile) if (!existsSync(directory)) { + myConsole.info('INFO | Creating directory ' + directory) mkdirSync(directory, { recursive: true }) } + myConsole.log('LOG | writing BOM to', options.outputFile) const written = await writeAllSync( options.outputFile === OutputStdOut ? process.stdout.fd From 661f2d92af771f6c5089e76ab922277225a6c499 Mon Sep 17 00:00:00 2001 From: cu <42832096+cuhland@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:31:54 +0100 Subject: [PATCH 03/14] Update src/cli.ts Co-authored-by: Jan Kowalleck Signed-off-by: cu <42832096+cuhland@users.noreply.github.com> --- src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index 2ef8341ef..a57a5517e 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -309,7 +309,7 @@ export async function run (process: NodeJS.Process): Promise { } const directory = dirname(options.outputFile) if (!existsSync(directory)) { - myConsole.info('INFO | Creating directory ' + directory) + myConsole.info('INFO | Creating directory', directory) mkdirSync(directory, { recursive: true }) } myConsole.log('LOG | writing BOM to', options.outputFile) From db22fb0dd616097eb07b2566074f55bb56142be0 Mon Sep 17 00:00:00 2001 From: cu <42832096+cuhland@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:32:04 +0100 Subject: [PATCH 04/14] Update src/cli.ts Co-authored-by: Jan Kowalleck Signed-off-by: cu <42832096+cuhland@users.noreply.github.com> --- src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index a57a5517e..0f0d2064d 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -316,7 +316,7 @@ export async function run (process: NodeJS.Process): Promise { const written = await writeAllSync( options.outputFile === OutputStdOut ? process.stdout.fd - : openSync(resolve(options.outputFile), 'w'), + : openSync(resolve(process.cwd(), options.outputFile), 'w'), serialized ) myConsole.info('INFO | wrote %d bytes to %s', written, options.outputFile) From 04f9736e9f1db9cbe82e0c047c0b85aa9ed41097 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sun, 22 Dec 2024 12:36:36 +0100 Subject: [PATCH 05/14] Update src/cli.ts Signed-off-by: Jan Kowalleck --- src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index 0f0d2064d..9aa587c7b 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -309,7 +309,7 @@ export async function run (process: NodeJS.Process): Promise { } const directory = dirname(options.outputFile) if (!existsSync(directory)) { - myConsole.info('INFO | Creating directory', directory) + myConsole.info('INFO | Creating directory', directory) mkdirSync(directory, { recursive: true }) } myConsole.log('LOG | writing BOM to', options.outputFile) From 36627c1a748406e602542dbf8f61452d8dba2516 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sun, 22 Dec 2024 12:40:16 +0100 Subject: [PATCH 06/14] dont create test dirs, let te tool do it for us Signed-off-by: Jan Kowalleck --- tests/integration/cli.from-collected.test.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/integration/cli.from-collected.test.js b/tests/integration/cli.from-collected.test.js index 472a0808a..a4355bc84 100644 --- a/tests/integration/cli.from-collected.test.js +++ b/tests/integration/cli.from-collected.test.js @@ -35,7 +35,6 @@ describe('integration.cli.from-collected', () => { const LATETS_NPM = '10' const tmpRootRun = join(tmpRoot, 'with-prepared') - mkdirSync(tmpRootRun) const _allDemoCases = indexNpmLsDemoData() const useCases = [ @@ -57,8 +56,6 @@ describe('integration.cli.from-collected', () => { ] describe.each(useCases)('$subject', (ud) => { - mkdirSync(join(tmpRootRun, ud.subject)) - test.each(ud.demoCases)('$subject $args npm$npm node$node $os', async (dd) => { const expectedOutSnap = join(demoResultsRoot, ud.subject, `${dd.subject}${dd.args}_npm${dd.npm}_node${dd.node}_${dd.os}.snap.json`) const logFileBase = join(tmpRootRun, ud.subject, `${dd.subject}${dd.args}_npm${dd.npm}_node${dd.node}_${dd.os}`) From 0cddfe6308158d1a8c8d55403b4be3d8d16eef37 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sun, 22 Dec 2024 12:41:08 +0100 Subject: [PATCH 07/14] Update cli.edge-cases.test.js Signed-off-by: Jan Kowalleck --- tests/integration/cli.edge-cases.test.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/integration/cli.edge-cases.test.js b/tests/integration/cli.edge-cases.test.js index 63a1f2471..42da0f1cc 100644 --- a/tests/integration/cli.edge-cases.test.js +++ b/tests/integration/cli.edge-cases.test.js @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ const { join } = require('path') -const { mkdirSync, writeFileSync, readFileSync } = require('fs') +const { writeFileSync, readFileSync } = require('fs') const { describe, expect, test } = require('@jest/globals') @@ -32,7 +32,6 @@ describe('integration.cli.edge-cases', () => { describe('broken project', () => { const tmpRootRun = join(tmpRoot, 'broken-project') - mkdirSync(tmpRootRun) test.each([ ['no-lockfile', /missing evidence/i], @@ -54,7 +53,6 @@ describe('integration.cli.edge-cases', () => { describe('with broken npm-ls', () => { const tmpRootRun = join(tmpRoot, 'with-broken') - mkdirSync(tmpRootRun) test('error on non-existing binary', async () => { const logFileBase = join(tmpRootRun, 'non-existing') @@ -115,7 +113,6 @@ describe('integration.cli.edge-cases', () => { test('suppressed error on non-zero exit', async () => { const dd = { subject: 'dev-dependencies', npm: '8', node: '14', os: 'ubuntu-latest' } - mkdirSync(join(tmpRoot, 'suppressed-error-on-non-zero-exit')) const expectedOutSnap = join(demoResultsRoot, 'suppressed-error-on-non-zero-exit', `${dd.subject}_npm${dd.npm}_node${dd.node}_${dd.os}.snap.json`) const logFileBase = join(tmpRoot, 'suppressed-error-on-non-zero-exit', `${dd.subject}_npm${dd.npm}_node${dd.node}_${dd.os}`) const cwd = dummyProjectsRoot From eeb150424cff404deb43553a6fb4dc3aee8f38c3 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sun, 22 Dec 2024 12:41:28 +0100 Subject: [PATCH 08/14] Update cli.from-collected.test.js Signed-off-by: Jan Kowalleck --- tests/integration/cli.from-collected.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/cli.from-collected.test.js b/tests/integration/cli.from-collected.test.js index a4355bc84..f9bc5bd87 100644 --- a/tests/integration/cli.from-collected.test.js +++ b/tests/integration/cli.from-collected.test.js @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ const { join } = require('path') -const { mkdirSync, writeFileSync, readFileSync } = require('fs') +const { writeFileSync, readFileSync } = require('fs') const { describe, expect, test } = require('@jest/globals') From 36e3cba2476ff38d9113f4ae74c1f05dc2890a3a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sun, 22 Dec 2024 12:42:22 +0100 Subject: [PATCH 09/14] Update cli.args-pass-through.test.js Signed-off-by: Jan Kowalleck --- tests/integration/cli.args-pass-through.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/cli.args-pass-through.test.js b/tests/integration/cli.args-pass-through.test.js index f9cc7521d..3cbd8a916 100644 --- a/tests/integration/cli.args-pass-through.test.js +++ b/tests/integration/cli.args-pass-through.test.js @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ const { join } = require('path') -const { mkdirSync, readFileSync } = require('fs') +const { readFileSync } = require('fs') const { describe, expect, test } = require('@jest/globals') @@ -31,7 +31,6 @@ describe('integration.cli.args-pass-through', () => { describe('npm-version depending npm-args', () => { const tmpRootRun = join(tmpRoot, 'npmVersion-depending-npmArgs') - mkdirSync(tmpRootRun) const rMinor = Math.round(99 * Math.random()) const rPatch = Math.round(99 * Math.random()) From 537ae972c395190c003711cce5d73e3d9824112a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sun, 22 Dec 2024 13:02:30 +0100 Subject: [PATCH 10/14] roll back to working tests Signed-off-by: Jan Kowalleck --- tests/integration/cli.args-pass-through.test.js | 3 ++- tests/integration/cli.edge-cases.test.js | 5 ++++- tests/integration/cli.from-collected.test.js | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/integration/cli.args-pass-through.test.js b/tests/integration/cli.args-pass-through.test.js index 3cbd8a916..f9cc7521d 100644 --- a/tests/integration/cli.args-pass-through.test.js +++ b/tests/integration/cli.args-pass-through.test.js @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ const { join } = require('path') -const { readFileSync } = require('fs') +const { mkdirSync, readFileSync } = require('fs') const { describe, expect, test } = require('@jest/globals') @@ -31,6 +31,7 @@ describe('integration.cli.args-pass-through', () => { describe('npm-version depending npm-args', () => { const tmpRootRun = join(tmpRoot, 'npmVersion-depending-npmArgs') + mkdirSync(tmpRootRun) const rMinor = Math.round(99 * Math.random()) const rPatch = Math.round(99 * Math.random()) diff --git a/tests/integration/cli.edge-cases.test.js b/tests/integration/cli.edge-cases.test.js index 42da0f1cc..63a1f2471 100644 --- a/tests/integration/cli.edge-cases.test.js +++ b/tests/integration/cli.edge-cases.test.js @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ const { join } = require('path') -const { writeFileSync, readFileSync } = require('fs') +const { mkdirSync, writeFileSync, readFileSync } = require('fs') const { describe, expect, test } = require('@jest/globals') @@ -32,6 +32,7 @@ describe('integration.cli.edge-cases', () => { describe('broken project', () => { const tmpRootRun = join(tmpRoot, 'broken-project') + mkdirSync(tmpRootRun) test.each([ ['no-lockfile', /missing evidence/i], @@ -53,6 +54,7 @@ describe('integration.cli.edge-cases', () => { describe('with broken npm-ls', () => { const tmpRootRun = join(tmpRoot, 'with-broken') + mkdirSync(tmpRootRun) test('error on non-existing binary', async () => { const logFileBase = join(tmpRootRun, 'non-existing') @@ -113,6 +115,7 @@ describe('integration.cli.edge-cases', () => { test('suppressed error on non-zero exit', async () => { const dd = { subject: 'dev-dependencies', npm: '8', node: '14', os: 'ubuntu-latest' } + mkdirSync(join(tmpRoot, 'suppressed-error-on-non-zero-exit')) const expectedOutSnap = join(demoResultsRoot, 'suppressed-error-on-non-zero-exit', `${dd.subject}_npm${dd.npm}_node${dd.node}_${dd.os}.snap.json`) const logFileBase = join(tmpRoot, 'suppressed-error-on-non-zero-exit', `${dd.subject}_npm${dd.npm}_node${dd.node}_${dd.os}`) const cwd = dummyProjectsRoot diff --git a/tests/integration/cli.from-collected.test.js b/tests/integration/cli.from-collected.test.js index f9bc5bd87..472a0808a 100644 --- a/tests/integration/cli.from-collected.test.js +++ b/tests/integration/cli.from-collected.test.js @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ const { join } = require('path') -const { writeFileSync, readFileSync } = require('fs') +const { mkdirSync, writeFileSync, readFileSync } = require('fs') const { describe, expect, test } = require('@jest/globals') @@ -35,6 +35,7 @@ describe('integration.cli.from-collected', () => { const LATETS_NPM = '10' const tmpRootRun = join(tmpRoot, 'with-prepared') + mkdirSync(tmpRootRun) const _allDemoCases = indexNpmLsDemoData() const useCases = [ @@ -56,6 +57,8 @@ describe('integration.cli.from-collected', () => { ] describe.each(useCases)('$subject', (ud) => { + mkdirSync(join(tmpRootRun, ud.subject)) + test.each(ud.demoCases)('$subject $args npm$npm node$node $os', async (dd) => { const expectedOutSnap = join(demoResultsRoot, ud.subject, `${dd.subject}${dd.args}_npm${dd.npm}_node${dd.node}_${dd.os}.snap.json`) const logFileBase = join(tmpRootRun, ud.subject, `${dd.subject}${dd.args}_npm${dd.npm}_node${dd.node}_${dd.os}`) From 3c5f2379791d2c62a6dafa7a00d8f50306170e39 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sun, 22 Dec 2024 13:49:11 +0100 Subject: [PATCH 11/14] test dir creation Signed-off-by: Jan Kowalleck --- src/cli.ts | 2 +- tests/integration/cli.from-setups.test.js | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 527d4393b..6673b3b87 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -317,7 +317,7 @@ export async function run (process: NodeJS.Process): Promise { } const directory = dirname(options.outputFile) if (!existsSync(directory)) { - myConsole.info('INFO | Creating directory', directory) + myConsole.info('INFO | creating directory', directory) mkdirSync(directory, { recursive: true }) } myConsole.log('LOG | writing BOM to', options.outputFile) diff --git a/tests/integration/cli.from-setups.test.js b/tests/integration/cli.from-setups.test.js index 6c3d7823b..acfa85408 100644 --- a/tests/integration/cli.from-setups.test.js +++ b/tests/integration/cli.from-setups.test.js @@ -18,8 +18,8 @@ Copyright (c) OWASP Foundation. All Rights Reserved. */ const { spawnSync } = require('child_process') -const { join } = require('path') -const { writeFileSync, readFileSync, mkdirSync } = require('fs') +const { dirname, join } = require('path') +const { writeFileSync, readFileSync } = require('fs') const { describe, expect, test } = require('@jest/globals') @@ -37,9 +37,6 @@ describe('integration.cli.from-setups', () => { const formats = ['json', 'xml'] describe('dummy_projects', () => { - const tmpRootRun = join(tmpRoot, 'with-prepared') - mkdirSync(tmpRootRun) - const useCases = [ { subject: 'bare', @@ -60,7 +57,8 @@ describe('integration.cli.from-setups', () => { function runTest (subject, project, format, additionalCliArgs = []) { const expectedOutSnap = join(dummyResultsRoot, subject, `${project}.snap.${format}`) - const outFile = join(tmpRoot, `${subject}_${project}.${format}`) + const outFile = join(tmpRoot, subject, `${project}.${format}`) + // no need to create that outFile dir first - the tool is expected to do that for us const res = spawnSync( process.execPath, ['--', cliWrapper, @@ -69,10 +67,11 @@ describe('integration.cli.from-setups', () => { '--output-format', format, '--output-reproducible', '--output-file', outFile, - '--validate' + '--validate', + '-vvv' ], { cwd: join(dummyProjectsRoot, project), - stdio: ['ignore', 'inherit', 'pipe'], + stdio: ['ignore', 'ignore', 'pipe'], encoding: 'utf8' } ) @@ -84,6 +83,7 @@ describe('integration.cli.from-setups', () => { process.stderr.write('\n') throw err } + const actualOutput = makeReproducible(format, readFileSync(outFile, 'utf8')) if (UPDATE_SNAPSHOTS) { @@ -97,8 +97,6 @@ describe('integration.cli.from-setups', () => { } describe.each(useCases)('subject: $subject', (ud) => { - mkdirSync(join(tmpRootRun, ud.subject)) - describe.each(ud.dummyProject)('dummyProject: %s', (dummyProject) => { describe.each(formats)('format: %s', (format) => { (skipAllTests From f038049c91389d7221612e3bc2193b530d6be744 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sun, 22 Dec 2024 13:53:53 +0100 Subject: [PATCH 12/14] test dir creation Signed-off-by: Jan Kowalleck --- tests/integration/cli.from-setups.test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/integration/cli.from-setups.test.js b/tests/integration/cli.from-setups.test.js index acfa85408..ee9fe3966 100644 --- a/tests/integration/cli.from-setups.test.js +++ b/tests/integration/cli.from-setups.test.js @@ -19,7 +19,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. const { spawnSync } = require('child_process') const { dirname, join } = require('path') -const { writeFileSync, readFileSync } = require('fs') +const { writeFileSync, readFileSync, existsSync} = require('fs') const { describe, expect, test } = require('@jest/globals') @@ -58,6 +58,7 @@ describe('integration.cli.from-setups', () => { function runTest (subject, project, format, additionalCliArgs = []) { const expectedOutSnap = join(dummyResultsRoot, subject, `${project}.snap.${format}`) const outFile = join(tmpRoot, subject, `${project}.${format}`) + const outDirExisted = existsSync(dirname(outFile)) // no need to create that outFile dir first - the tool is expected to do that for us const res = spawnSync( process.execPath, @@ -84,6 +85,10 @@ describe('integration.cli.from-setups', () => { throw err } + const expectStdErr = expect(res.stderr); + (outDirExisted ? expectStdErr.not : expectStdErr).toContain(`creating directory ${dirname(outFile)}`) + expectStdErr.toMatch(new RegExp(`wrote \\d+ bytes to ${outFile}`)) + const actualOutput = makeReproducible(format, readFileSync(outFile, 'utf8')) if (UPDATE_SNAPSHOTS) { From 5b1f49c59ddac71ba52f6bdf92ccd49947e24b9a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sun, 22 Dec 2024 14:07:24 +0100 Subject: [PATCH 13/14] style Signed-off-by: Jan Kowalleck --- tests/integration/cli.from-setups.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/cli.from-setups.test.js b/tests/integration/cli.from-setups.test.js index ee9fe3966..c8133a999 100644 --- a/tests/integration/cli.from-setups.test.js +++ b/tests/integration/cli.from-setups.test.js @@ -19,7 +19,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved. const { spawnSync } = require('child_process') const { dirname, join } = require('path') -const { writeFileSync, readFileSync, existsSync} = require('fs') +const { writeFileSync, readFileSync, existsSync } = require('fs') const { describe, expect, test } = require('@jest/globals') From 41f5b368edbd502996173d164d332cd1c9006e09 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sun, 22 Dec 2024 14:24:34 +0100 Subject: [PATCH 14/14] test regex escaped Signed-off-by: Jan Kowalleck --- tests/_helper/index.js | 11 ++++++++++- tests/integration/cli.from-setups.test.js | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/_helper/index.js b/tests/_helper/index.js index cd01ed642..c3ea4fd6e 100644 --- a/tests/_helper/index.js +++ b/tests/_helper/index.js @@ -155,8 +155,17 @@ function getNpmVersion () { return v } +/** + * @param {string} s + * @return {string} + */ +function regexEscape (s) { + return s.replace(/[\^$(){}[\]+*?.|\\-]/g, '\\$&') +} + module.exports = { hashFile, makeReproducible, - getNpmVersion + getNpmVersion, + regexEscape } diff --git a/tests/integration/cli.from-setups.test.js b/tests/integration/cli.from-setups.test.js index c8133a999..a05c4c6e6 100644 --- a/tests/integration/cli.from-setups.test.js +++ b/tests/integration/cli.from-setups.test.js @@ -23,7 +23,7 @@ const { writeFileSync, readFileSync, existsSync } = require('fs') const { describe, expect, test } = require('@jest/globals') -const { makeReproducible, getNpmVersion } = require('../_helper') +const { makeReproducible, getNpmVersion, regexEscape } = require('../_helper') const { UPDATE_SNAPSHOTS, mkTemp, cliWrapper, latestCdxSpecVersion, dummyProjectsRoot, dummyResultsRoot, projectDemoRootPath, demoResultsRoot } = require('./') describe('integration.cli.from-setups', () => { @@ -87,7 +87,7 @@ describe('integration.cli.from-setups', () => { const expectStdErr = expect(res.stderr); (outDirExisted ? expectStdErr.not : expectStdErr).toContain(`creating directory ${dirname(outFile)}`) - expectStdErr.toMatch(new RegExp(`wrote \\d+ bytes to ${outFile}`)) + expectStdErr.toMatch(new RegExp(`wrote \\d+ bytes to ${regexEscape(outFile)}`)) const actualOutput = makeReproducible(format, readFileSync(outFile, 'utf8'))