diff --git a/apps/zipsync/src/ZipSyncCommandLineParser.ts b/apps/zipsync/src/cli/ZipSyncCommandLineParser.ts similarity index 97% rename from apps/zipsync/src/ZipSyncCommandLineParser.ts rename to apps/zipsync/src/cli/ZipSyncCommandLineParser.ts index c0c71bcc306..594ad4c9ab6 100644 --- a/apps/zipsync/src/ZipSyncCommandLineParser.ts +++ b/apps/zipsync/src/cli/ZipSyncCommandLineParser.ts @@ -11,8 +11,8 @@ import type { import type { ConsoleTerminalProvider } from '@rushstack/terminal/lib/ConsoleTerminalProvider'; import type { ITerminal } from '@rushstack/terminal/lib/ITerminal'; -import type { IZipSyncMode, ZipSyncOptionCompression } from './zipSyncUtils'; -import { pack, unpack } from './index'; +import type { IZipSyncMode, ZipSyncOptionCompression } from '../zipSyncUtils'; +import { pack, unpack } from '../index'; export class ZipSyncCommandLineParser extends CommandLineParser { private readonly _debugParameter: CommandLineFlagParameter; diff --git a/apps/zipsync/src/__snapshots__/start.test.ts.snap b/apps/zipsync/src/cli/test/__snapshots__/start.test.ts.snap similarity index 97% rename from apps/zipsync/src/__snapshots__/start.test.ts.snap rename to apps/zipsync/src/cli/test/__snapshots__/start.test.ts.snap index 6c68a44b411..e005983feb4 100644 --- a/apps/zipsync/src/__snapshots__/start.test.ts.snap +++ b/apps/zipsync/src/cli/test/__snapshots__/start.test.ts.snap @@ -2,7 +2,7 @@ exports[`CLI Tool Tests should display help for "zipsync --help" 1`] = ` " -zipsync 0.0.0 - https://rushstack.io +zipsync {version} - https://rushstack.io usage: zipsync [-h] [-d] [-v] -m {pack,unpack} -a ARCHIVE_PATH -t TARGET_DIRECTORIES -b BASE_DIR -z {store,deflate,zstd,auto} diff --git a/apps/zipsync/src/cli/test/start.test.ts b/apps/zipsync/src/cli/test/start.test.ts new file mode 100644 index 00000000000..f57f26a3ce6 --- /dev/null +++ b/apps/zipsync/src/cli/test/start.test.ts @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. +// See LICENSE in the project root for license information. + +import path from 'node:path'; +import { execSync } from 'node:child_process'; + +describe('CLI Tool Tests', () => { + it('should display help for "zipsync --help"', () => { + const packageFolder: string = path.resolve(__dirname, '../../..'); + const startOutput = execSync('node lib/start.js --help', { encoding: 'utf-8', cwd: packageFolder }); + const normalized = startOutput.replace( + /zipsync \d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)? - https:\/\/rushstack\.io/, + 'zipsync {version} - https://rushstack.io' + ); + expect(normalized).toMatchSnapshot(); + }); +}); diff --git a/apps/zipsync/src/start.test.ts b/apps/zipsync/src/start.test.ts deleted file mode 100644 index ce4cb7fba4d..00000000000 --- a/apps/zipsync/src/start.test.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -// See LICENSE in the project root for license information. - -import { execSync } from 'child_process'; - -describe('CLI Tool Tests', () => { - it('should display help for "zipsync --help"', () => { - const startOutput = execSync('node lib/start.js --help').toString(); - expect(startOutput).toMatchSnapshot(); - }); -}); diff --git a/apps/zipsync/src/start.ts b/apps/zipsync/src/start.ts index f1bf39e55c0..14e23e53406 100644 --- a/apps/zipsync/src/start.ts +++ b/apps/zipsync/src/start.ts @@ -5,7 +5,7 @@ import { ConsoleTerminalProvider } from '@rushstack/terminal/lib/ConsoleTerminal import { Terminal } from '@rushstack/terminal/lib/Terminal'; import { version } from '../package.json'; -import { ZipSyncCommandLineParser } from './ZipSyncCommandLineParser'; +import { ZipSyncCommandLineParser } from './cli/ZipSyncCommandLineParser'; const toolVersion: string = version; diff --git a/apps/zipsync/src/benchmark.test.ts b/apps/zipsync/src/test/benchmark.test.ts similarity index 97% rename from apps/zipsync/src/benchmark.test.ts rename to apps/zipsync/src/test/benchmark.test.ts index fdbdaa67d6b..dab74ac15c5 100644 --- a/apps/zipsync/src/benchmark.test.ts +++ b/apps/zipsync/src/test/benchmark.test.ts @@ -2,17 +2,17 @@ // See LICENSE in the project root for license information. /* eslint-disable no-console */ -import { execSync } from 'child_process'; -import { tmpdir, cpus, platform, release, arch, totalmem } from 'os'; -import * as path from 'path'; -import * as fs from 'fs'; -import { createHash, randomUUID } from 'crypto'; +import { execSync } from 'node:child_process'; +import { tmpdir, cpus, platform, release, arch, totalmem } from 'node:os'; +import * as path from 'node:path'; +import * as fs from 'node:fs'; +import { createHash, randomUUID } from 'node:crypto'; import { NoOpTerminalProvider, Terminal } from '@rushstack/terminal'; -import type { ZipSyncOptionCompression } from './zipSyncUtils'; -import { pack } from './pack'; -import { unpack } from './unpack'; +import type { ZipSyncOptionCompression } from '../zipSyncUtils'; +import { pack } from '../pack'; +import { unpack } from '../unpack'; const compressionOptions = ['store', 'deflate', 'zstd', 'auto'] satisfies ZipSyncOptionCompression[]; @@ -461,7 +461,9 @@ zipsync internally handles cleaning as part of its operation. outputLines.push('| OS | Arch | Node | CPU | Logical Cores | Memory |'); outputLines.push('| --- | --- | --- | --- | ---: | --- |'); outputLines.push( - `| ${platform()} ${release()} | ${arch()} | ${process.version} | ${cpuModel} | ${logicalCores} | ${memGB} GB |` + `| ${platform()} ${release()} | ${arch()} | ${ + process.version + } | ${cpuModel} | ${logicalCores} | ${memGB} GB |` ); outputLines.push(''); } catch { diff --git a/apps/zipsync/src/crc32.test.ts b/apps/zipsync/src/test/crc32.test.ts similarity index 92% rename from apps/zipsync/src/crc32.test.ts rename to apps/zipsync/src/test/crc32.test.ts index fb73eb5f9d5..67ccbb9180c 100644 --- a/apps/zipsync/src/crc32.test.ts +++ b/apps/zipsync/src/test/crc32.test.ts @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information. -import * as zlib from 'zlib'; +import * as zlib from 'node:zlib'; -import { fallbackCrc32 } from './crc32'; +import { fallbackCrc32 } from '../crc32'; describe('crc32', () => { it('fallbackCrc32 should match zlib.crc32', () => { diff --git a/apps/zipsync/src/index.test.ts b/apps/zipsync/src/test/index.test.ts similarity index 95% rename from apps/zipsync/src/index.test.ts rename to apps/zipsync/src/test/index.test.ts index 5fe98676aca..42dd8d96331 100644 --- a/apps/zipsync/src/index.test.ts +++ b/apps/zipsync/src/test/index.test.ts @@ -7,10 +7,10 @@ import * as fs from 'node:fs'; import { NoOpTerminalProvider } from '@rushstack/terminal/lib/NoOpTerminalProvider'; import { Terminal } from '@rushstack/terminal/lib/Terminal'; -import { pack } from './pack'; -import { unpack } from './unpack'; +import { pack } from '../pack'; +import { unpack } from '../unpack'; import { getDemoDataDirectoryDisposable } from './testUtils'; -import type { ZipSyncOptionCompression } from './zipSyncUtils'; +import type { ZipSyncOptionCompression } from '../zipSyncUtils'; describe('zipSync tests', () => { it(`basic pack test`, () => { diff --git a/apps/zipsync/src/testUtils.ts b/apps/zipsync/src/test/testUtils.ts similarity index 97% rename from apps/zipsync/src/testUtils.ts rename to apps/zipsync/src/test/testUtils.ts index ed1555c3cd8..5adc33184d6 100644 --- a/apps/zipsync/src/testUtils.ts +++ b/apps/zipsync/src/test/testUtils.ts @@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'; import * as path from 'node:path'; import * as fs from 'node:fs'; import * as crypto from 'node:crypto'; -import type { IMetadata } from './zipSyncUtils'; +import type { IMetadata } from '../zipSyncUtils'; export function getTempDir(): string { const randomId: string = crypto.randomUUID(); diff --git a/apps/zipsync/src/workerAsync.test.ts b/apps/zipsync/src/test/workerAsync.test.ts similarity index 94% rename from apps/zipsync/src/workerAsync.test.ts rename to apps/zipsync/src/test/workerAsync.test.ts index 1392f51223f..07a09357259 100644 --- a/apps/zipsync/src/workerAsync.test.ts +++ b/apps/zipsync/src/test/workerAsync.test.ts @@ -4,8 +4,8 @@ import * as path from 'node:path'; import * as fs from 'node:fs'; -import { unpackWorkerAsync } from './unpackWorkerAsync'; -import { packWorkerAsync } from './packWorkerAsync'; +import { unpackWorkerAsync } from '../unpackWorkerAsync'; +import { packWorkerAsync } from '../packWorkerAsync'; import { getDemoDataDirectoryDisposable } from './testUtils'; describe('zipSyncWorkerAsync tests', () => { diff --git a/common/changes/@rushstack/zipsync/bmiddha-fix-snapshots_2025-09-30-22-09.json b/common/changes/@rushstack/zipsync/bmiddha-fix-snapshots_2025-09-30-22-09.json new file mode 100644 index 00000000000..56706305c1e --- /dev/null +++ b/common/changes/@rushstack/zipsync/bmiddha-fix-snapshots_2025-09-30-22-09.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@rushstack/zipsync", + "comment": "", + "type": "none" + } + ], + "packageName": "@rushstack/zipsync" +} \ No newline at end of file