1 import { stat } from 'fs-extra'
2 import { basename, isAbsolute, join, resolve } from 'path'
4 function parallelTests () {
5 return process.env.MOCHA_PARALLEL === 'true'
8 function isGithubCI () {
9 return !!process.env.GITHUB_WORKSPACE
12 function areHttpImportTestsDisabled () {
13 const disabled = process.env.DISABLE_HTTP_IMPORT_TESTS === 'true'
15 if (disabled) console.log('Import tests are disabled')
20 function buildAbsoluteFixturePath (path: string, customCIPath = false) {
21 if (isAbsolute(path)) return path
23 if (customCIPath && process.env.GITHUB_WORKSPACE) {
24 return join(process.env.GITHUB_WORKSPACE, 'fixtures', path)
27 return join(root(), 'server', 'tests', 'fixtures', path)
32 let root = join(__dirname, '..', '..', '..')
34 if (basename(root) === 'dist') root = resolve(root, '..')
39 function wait (milliseconds: number) {
40 return new Promise(resolve => setTimeout(resolve, milliseconds))
43 async function getFileSize (path: string) {
44 const stats = await stat(path)
49 function buildRequestStub (): any {
56 areHttpImportTestsDisabled,
57 buildAbsoluteFixturePath,