test: updating path separator for mochaEvents (#28265)

This commit is contained in:
Matt Schile
2023-11-07 12:31:23 -07:00
committed by GitHub
parent 79da763dfa
commit 7392f615fe
2 changed files with 5 additions and 1 deletions

View File

@@ -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 >>

View File

@@ -204,5 +204,8 @@ function sanitizeMochaEvents (args: CypressInCypressMochaEvent[]) {
}
function getCallerFilename () {
return (new Error()).stack!.split('\n')[1].split('/').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]
}