From ebbb2f024104348aae08c40846c178633d5525f0 Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Wed, 7 Feb 2024 17:00:55 -0600 Subject: [PATCH] fix(testing): cleanup e2e atomization plugins (#21688) --- packages/cypress/plugins/cypress-preset.ts | 2 +- packages/cypress/src/plugins/plugin.ts | 2 +- packages/cypress/src/utils/{symbols.ts => constants.ts} | 2 +- packages/playwright/src/plugins/plugin.ts | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) rename packages/cypress/src/utils/{symbols.ts => constants.ts} (55%) diff --git a/packages/cypress/plugins/cypress-preset.ts b/packages/cypress/plugins/cypress-preset.ts index e4f387e245070..3d0066113044e 100644 --- a/packages/cypress/plugins/cypress-preset.ts +++ b/packages/cypress/plugins/cypress-preset.ts @@ -3,7 +3,7 @@ import { dirname, join, relative } from 'path'; import { lstatSync } from 'fs'; import vitePreprocessor from '../src/plugins/preprocessor-vite'; -import { NX_PLUGIN_OPTIONS } from '../src/utils/symbols'; +import { NX_PLUGIN_OPTIONS } from '../src/utils/constants'; import { exec } from 'child_process'; import { request as httpRequest } from 'http'; diff --git a/packages/cypress/src/plugins/plugin.ts b/packages/cypress/src/plugins/plugin.ts index 822f8a77878c3..8a815da95936a 100644 --- a/packages/cypress/src/plugins/plugin.ts +++ b/packages/cypress/src/plugins/plugin.ts @@ -18,7 +18,7 @@ import { existsSync, readdirSync } from 'fs'; import { globWithWorkspaceContext } from 'nx/src/utils/workspace-context'; import { calculateHashForCreateNodes } from '@nx/devkit/src/utils/calculate-hash-for-create-nodes'; import { projectGraphCacheDirectory } from 'nx/src/utils/cache-directory'; -import { NX_PLUGIN_OPTIONS } from '../utils/symbols'; +import { NX_PLUGIN_OPTIONS } from '../utils/constants'; import { loadConfigFile } from '@nx/devkit/src/utils/config-utils'; export interface CypressPluginOptions { diff --git a/packages/cypress/src/utils/symbols.ts b/packages/cypress/src/utils/constants.ts similarity index 55% rename from packages/cypress/src/utils/symbols.ts rename to packages/cypress/src/utils/constants.ts index f72080df39a53..d42062e06cc35 100644 --- a/packages/cypress/src/utils/symbols.ts +++ b/packages/cypress/src/utils/constants.ts @@ -1,4 +1,4 @@ /** * Key used to store options used by the nx plugin for @nx/cypress. */ -export const NX_PLUGIN_OPTIONS = Symbol('Nx Plugin Options'); +export const NX_PLUGIN_OPTIONS = '__NxPluginOptions__'; diff --git a/packages/playwright/src/plugins/plugin.ts b/packages/playwright/src/plugins/plugin.ts index 6b77beae44b44..33ddf9e258b4a 100644 --- a/packages/playwright/src/plugins/plugin.ts +++ b/packages/playwright/src/plugins/plugin.ts @@ -7,6 +7,7 @@ import { CreateNodesContext, detectPackageManager, joinPathFragments, + normalizePath, readJsonFile, TargetConfiguration, writeJsonFile, @@ -157,7 +158,9 @@ async function buildPlaywrightTargets( const dependsOn: TargetConfiguration['dependsOn'] = []; forEachTestFile( (testFile) => { - const relativeToProjectRoot = relative(projectRoot, testFile); + const relativeToProjectRoot = normalizePath( + relative(projectRoot, testFile) + ); const targetName = `${options.ciTargetName}--${relativeToProjectRoot}`; targets[targetName] = { ...ciBaseTargetConfig,