1 import { basename, extname, isAbsolute, join, resolve } from 'path'
6 if (rootPath) return rootPath
10 if (basename(rootPath) === 'tools') rootPath = resolve(rootPath, '..')
11 if (basename(rootPath) === 'scripts') rootPath = resolve(rootPath, '..')
12 if (basename(rootPath) === 'common') rootPath = resolve(rootPath, '..')
13 if (basename(rootPath) === 'core-utils') rootPath = resolve(rootPath, '..')
14 if (basename(rootPath) === 'shared') rootPath = resolve(rootPath, '..')
15 if (basename(rootPath) === 'server') rootPath = resolve(rootPath, '..')
16 if (basename(rootPath) === 'dist') rootPath = resolve(rootPath, '..')
21 function buildPath (path: string) {
22 if (isAbsolute(path)) return path
24 return join(root(), path)
27 function getLowercaseExtension (filename: string) {
28 const ext = extname(filename) || ''
30 return ext.toLowerCase()
33 function buildAbsoluteFixturePath (path: string, customCIPath = false) {
34 if (isAbsolute(path)) return path
36 if (customCIPath && process.env.GITHUB_WORKSPACE) {
37 return join(process.env.GITHUB_WORKSPACE, 'fixtures', path)
40 return join(root(), 'server', 'tests', 'fixtures', path)
46 buildAbsoluteFixturePath,