From ca1c98f4ef22a74e7cbb6aaec1641ceeec857980 Mon Sep 17 00:00:00 2001 From: Matthew Schile Date: Tue, 7 Nov 2023 10:50:55 -0700 Subject: [PATCH 1/2] test: updating path separator for mochaEvents --- .circleci/workflows.yml | 1 + packages/app/cypress/e2e/runner/support/mochaEventsUtils.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/workflows.yml b/.circleci/workflows.yml index f76627d252ee..4b736d3c0602 100644 --- a/.circleci/workflows.yml +++ b/.circleci/workflows.yml @@ -85,6 +85,7 @@ windowsWorkflowFilters: &windows-workflow-filters - equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ] - equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ] - equal: [ 'em/shallow-checkout', << pipeline.git.branch >> ] + - equal: [ 'mschile/mochaEvents_win_sep', << pipeline.git.branch >> ] - matches: pattern: /^release\/\d+\.\d+\.\d+$/ value: << pipeline.git.branch >> diff --git a/packages/app/cypress/e2e/runner/support/mochaEventsUtils.ts b/packages/app/cypress/e2e/runner/support/mochaEventsUtils.ts index a0182a0ebc30..9b7170f0fa64 100644 --- a/packages/app/cypress/e2e/runner/support/mochaEventsUtils.ts +++ b/packages/app/cypress/e2e/runner/support/mochaEventsUtils.ts @@ -3,6 +3,7 @@ import _ from 'lodash' import type { MochaLifecycleData, SanitizedMochaLifecycleData } from './mochaTypes' import EventEmitter from 'events' import disparity from 'disparity' +import path from 'path' const hooks = { before: ['before all', 'before each'], @@ -204,5 +205,5 @@ function sanitizeMochaEvents (args: CypressInCypressMochaEvent[]) { } function getCallerFilename () { - return (new Error()).stack!.split('\n')[1].split('/').slice(-1)[0].split(':')[0] + return (new Error()).stack!.split('\n')[1].split(path.sep).slice(-1)[0].split(':')[0] } From fb9d04085d3b2fd73a3a2c11b88bab9110ec7739 Mon Sep 17 00:00:00 2001 From: Matthew Schile Date: Tue, 7 Nov 2023 12:09:17 -0700 Subject: [PATCH 2/2] updated fix --- packages/app/cypress/e2e/runner/support/mochaEventsUtils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/app/cypress/e2e/runner/support/mochaEventsUtils.ts b/packages/app/cypress/e2e/runner/support/mochaEventsUtils.ts index 9b7170f0fa64..8c3050927d94 100644 --- a/packages/app/cypress/e2e/runner/support/mochaEventsUtils.ts +++ b/packages/app/cypress/e2e/runner/support/mochaEventsUtils.ts @@ -3,7 +3,6 @@ import _ from 'lodash' import type { MochaLifecycleData, SanitizedMochaLifecycleData } from './mochaTypes' import EventEmitter from 'events' import disparity from 'disparity' -import path from 'path' const hooks = { before: ['before all', 'before each'], @@ -205,5 +204,8 @@ function sanitizeMochaEvents (args: CypressInCypressMochaEvent[]) { } function getCallerFilename () { - return (new Error()).stack!.split('\n')[1].split(path.sep).slice(-1)[0].split(':')[0] + const line = (new Error()).stack!.split('\n')[1] + const pathSep = line.includes('\\') ? '\\' : '/' + + return line.split(pathSep).slice(-1)[0].split(':')[0] }