Skip to content

Commit

Permalink
force relative pathing wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AtofStryker committed May 15, 2024
1 parent 8a913dd commit 37c01ca
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions npm/vite-dev-server/client/initCypressTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,36 @@ const devServerPublicPathRoute = CypressInstance.config('devServerPublicPathRout
if (supportFile) {
let supportRelativeToProjectRoot = supportFile.replace(projectRoot, '')

console.log('support before', supportRelativeToProjectRoot)
if (CypressInstance.config('platform') === 'win32') {
const platformProjectRoot = projectRoot.replaceAll('/', '\\')

supportRelativeToProjectRoot = supportFile.replace(platformProjectRoot, '')
console.log('support after', supportRelativeToProjectRoot)
}

console.log(devServerPublicPathRoute)
console.log(supportRelativeToProjectRoot)

supportRelativeToProjectRoot = supportRelativeToProjectRoot.replaceAll('\\', '/')
console.log(supportRelativeToProjectRoot)
// supportRelativeToProjectRoot = 'cypress\\support\\component.js'
// console.log('support override', supportRelativeToProjectRoot)

// We need a slash before /cypress/supportFile.js, this happens by default
// with the current string replacement logic.

let pathing = devServerPublicPathRoute

if (devServerPublicPathRoute === '') {
pathing = '.'
}

importsToLoad.push({
load: () => import(`${devServerPublicPathRoute}${supportRelativeToProjectRoot}`),
load: () => import(`${pathing}${supportRelativeToProjectRoot}`),
absolute: supportFile,
relative: supportRelativeToProjectRoot,
relativeUrl: `${devServerPublicPathRoute}${supportRelativeToProjectRoot}`,
relativeUrl: `${pathing}${supportRelativeToProjectRoot}`,
})
}

Expand Down

0 comments on commit 37c01ca

Please sign in to comment.