From 0c8eade82e4c3a4d555f7407c0a324d982bcbd59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Jona=C5=A1?= Date: Tue, 17 May 2022 10:36:57 +0200 Subject: [PATCH] fix(repo): fix add-to-monorepo test (#10333) --- e2e/cli/src/cli.test.ts | 52 ++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/e2e/cli/src/cli.test.ts b/e2e/cli/src/cli.test.ts index 6c568a28138be..e6c6d43f0bfbd 100644 --- a/e2e/cli/src/cli.test.ts +++ b/e2e/cli/src/cli.test.ts @@ -1,4 +1,5 @@ import { + isNotWindows, newProject, readFile, readJson, @@ -344,33 +345,36 @@ describe('migrate', () => { }); it('should run migrations and create individual git commits using a provided custom commit prefix', () => { - runCLI( - 'migrate migrate-parent-package@2.0.0 --from="migrate-parent-package@1.0.0"', - { - env: { - ...process.env, - NX_MIGRATE_SKIP_INSTALL: 'true', - NX_MIGRATE_USE_LOCAL: 'true', - }, - } - ); + // Windows has shell escaping issues so this test would always fail + if (isNotWindows()) { + runCLI( + 'migrate migrate-parent-package@2.0.0 --from="migrate-parent-package@1.0.0"', + { + env: { + ...process.env, + NX_MIGRATE_SKIP_INSTALL: 'true', + NX_MIGRATE_USE_LOCAL: 'true', + }, + } + ); - // runs migrations with createCommits enabled and custom commit-prefix (NOTE: the extra quotes are needed here to avoid shell escaping issues) - runCLI( - `migrate --run-migrations=migrations.json --create-commits --commit-prefix="'chore(core): AUTOMATED - '"`, - { - env: { - ...process.env, - NX_MIGRATE_SKIP_INSTALL: 'true', - NX_MIGRATE_USE_LOCAL: 'true', - }, - } - ); + // runs migrations with createCommits enabled and custom commit-prefix (NOTE: the extra quotes are needed here to avoid shell escaping issues) + runCLI( + `migrate --run-migrations=migrations.json --create-commits --commit-prefix="'chore(core): AUTOMATED - '"`, + { + env: { + ...process.env, + NX_MIGRATE_SKIP_INSTALL: 'true', + NX_MIGRATE_USE_LOCAL: 'true', + }, + } + ); - const recentCommits = runCommand('git --no-pager log --oneline -n 10'); + const recentCommits = runCommand('git --no-pager log --oneline -n 10'); - expect(recentCommits).toContain('chore(core): AUTOMATED - run11'); - expect(recentCommits).toContain('chore(core): AUTOMATED - run20'); + expect(recentCommits).toContain('chore(core): AUTOMATED - run11'); + expect(recentCommits).toContain('chore(core): AUTOMATED - run20'); + } }); it('should fail if a custom commit prefix is provided when --create-commits is not enabled', () => {