Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update container.js
Fixed #4863
  • Loading branch information
mjalav committed Feb 26, 2025
commit 39bc0098876aadc8319d1926fb3425b7ebde869c
15 changes: 14 additions & 1 deletion lib/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ function loadGherkinSteps(paths) {
loadSupportObject(path, `Step Definition from ${path}`)
}
} else {
const folderPath = paths.startsWith('.') ? path.join(global.codecept_dir, paths) : ''
const folderPath = paths.startsWith('.') ? normalizeAndJoin(global.codecept_dir, paths) : ''
if (folderPath !== '') {
globSync(folderPath).forEach(file => {
loadSupportObject(file, `Step Definition from ${file}`)
Expand Down Expand Up @@ -562,3 +562,16 @@ function getHelperModuleName(helperName, config) {
// built-in helpers
return `./helper/${helperName}`
}

function normalizeAndJoin(basePath, subPath) {
// Normalize the path (handles extra slashes and resolves `..`)
let normalizedBase = path.normalize(basePath);
let normalizedSub = path.normalize(subPath);

// Replace backslashes with forward slashes
normalizedBase = normalizedBase.replace(/\\/g, '/');
normalizedSub = normalizedSub.replace(/\\/g, '/');

// Join the paths using POSIX-style
return path.posix.join(normalizedBase, normalizedSub);
}
Loading