mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-13 19:09:03 -05:00
792980ac12
* use new specPattern API * remove projectApi.findSpecs * do not require integration folder * support --spec * support --spec * remove old code * remove old code * nuke old code * no appvetor * update * correct url for ct * work on migrating launchpad * update ct spec url * types * types * dead code * remove old endpiont * revert back circle.yml * update missing config * delete spec util * update config * update config * config again * update spec pattern * updated vue config * update spec pattern for ui components * update config for vite dev server * update snapshots * update config * update design system config * fix spec pattern in reporter * update default * update deprecated spec snapshots * update system tests * update run mode output * revert changes * lint * remove scaffold tests * update angular * fix CT * update circle yml * fix system tests for ct * fix tests * work on server unit tests * patch package * patch package again * update test * try not to rely on config async loading too much * normalize specPattern to array * update snapshot * use base name * deal with react-scripts later * update snapshot * hacky way to update snapshots * new hack to update snapshots * trying again * hacky fix * ci: snapshots * ci: snapshots * snapshots * mas updates * update spec API * fix test * fix test * update * update test * fix test * update plugin * update spec * webpack optinos * Update launchpad tests * fix screenshot paths * updated snapshot * change pattern * guard * fix smoke test * patch code coverage * update percy config * fix specs * try updating example project * update snapshots * remove old test * remove snapshot hack * add back appveyor * remove old code * update snapshot * Fix tests * wip * revert snapshot * reverted all snaps * remove only * remove commnet * remove old code * reverted file * lint * revert video compression spec * update snapshot * update spec path logic * update snap * updated snap * snaps * snaps * fix spec * rename ignoreTestFiles to ignoreSpecPattern * update screenshot dir for runner-ct * update deprecations * update * upate * fix test * update snaps * update snap * updating snap * added missing snaps * updated cypress run mode integration spec * electron snapshot * ensure newly scaffold specs are cached * fix launchpad spec * types * update test * transpile based on spec pattern * add back example * remove unnecessary async and nodeVersion * removed old test * update spec pattern and add defensive check around platform * remove unused feature flag * added tests * fix react example * update test * update config * fix spec finding in run mode * fix tests * fixing specs * fix switching between specs * remove invalid test * increase timeout Co-authored-by: estrada9166 <estrada9166@hotmail.com>
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
const path = require('path')
|
|
const { fs } = require('./fs')
|
|
|
|
// require.resolve walks the symlinks, which can really change
|
|
// the results. For example
|
|
// /tmp/foo is symlink to /private/tmp/foo on Mac
|
|
// thus resolving /tmp/foo to find /tmp/foo/index.js
|
|
// can return /private/tmp/foo/index.js
|
|
// which can really confuse the rest of the code.
|
|
// Detect this switch by checking if the resolution of absolute
|
|
// paths moved the prefix
|
|
//
|
|
// Good case: no switcheroo, return false
|
|
// /foo/bar -> /foo/bar/index.js
|
|
// Bad case: return true
|
|
// /tmp/foo/bar -> /private/tmp/foo/bar/index.js
|
|
const checkIfResolveChangedRootFolder = (resolved, initial) => {
|
|
return path.isAbsolute(resolved) &&
|
|
path.isAbsolute(initial) &&
|
|
!resolved.startsWith(initial)
|
|
}
|
|
|
|
// real folder path found could be different due to symlinks
|
|
// For example, folder /tmp/foo on Mac is really /private/tmp/foo
|
|
const getRealFolderPath = (folder) => {
|
|
// TODO check if folder is a non-empty string
|
|
if (!folder) {
|
|
throw new Error('Expected folder')
|
|
}
|
|
|
|
return fs.realpathAsync(folder)
|
|
}
|
|
|
|
module.exports = {
|
|
checkIfResolveChangedRootFolder,
|
|
|
|
getRealFolderPath,
|
|
}
|