File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -469,7 +469,7 @@ function loadGherkinSteps(paths) {
469469 loadSupportObject ( path , `Step Definition from ${ path } ` )
470470 }
471471 } else {
472- const folderPath = paths . startsWith ( '.' ) ? path . join ( global . codecept_dir , paths ) : ''
472+ const folderPath = paths . startsWith ( '.' ) ? normalizeAndJoin ( global . codecept_dir , paths ) : ''
473473 if ( folderPath !== '' ) {
474474 globSync ( folderPath ) . forEach ( file => {
475475 loadSupportObject ( file , `Step Definition from ${ file } ` )
@@ -562,3 +562,16 @@ function getHelperModuleName(helperName, config) {
562562 // built-in helpers
563563 return `./helper/${ helperName } `
564564}
565+
566+ function normalizeAndJoin ( basePath , subPath ) {
567+ // Normalize the path (handles extra slashes and resolves `..`)
568+ let normalizedBase = path . normalize ( basePath ) ;
569+ let normalizedSub = path . normalize ( subPath ) ;
570+
571+ // Replace backslashes with forward slashes
572+ normalizedBase = normalizedBase . replace ( / \\ / g, '/' ) ;
573+ normalizedSub = normalizedSub . replace ( / \\ / g, '/' ) ;
574+
575+ // Join the paths using POSIX-style
576+ return path . posix . join ( normalizedBase , normalizedSub ) ;
577+ }
You can’t perform that action at this time.
0 commit comments