1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Add CLI plugins tests

This commit is contained in:
Chocobozzz 2019-07-19 10:37:35 +02:00 committed by Chocobozzz
parent 32fe001389
commit 9b474844e8
22 changed files with 611 additions and 170 deletions

View file

@ -4,7 +4,7 @@
*/
import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto'
import { isAbsolute, join } from 'path'
import { basename, isAbsolute, join, resolve } from 'path'
import * as pem from 'pem'
import { URL } from 'url'
import { truncate } from 'lodash'
@ -136,16 +136,16 @@ function getAppNumber () {
return process.env.NODE_APP_INSTANCE
}
let rootPath: string
function root () {
if (rootPath) return rootPath
// We are in /helpers/utils.js
const paths = [ __dirname, '..', '..' ]
rootPath = join(__dirname, '..', '..')
// We are under /dist directory
if (process.mainModule && process.mainModule.filename.endsWith('_mocha') === false) {
paths.push('..')
}
if (basename(rootPath) === 'dist') rootPath = resolve(rootPath, '..')
return join.apply(null, paths)
return rootPath
}
// Thanks: https://stackoverflow.com/a/12034334