aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-09-07 15:27:35 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-09-07 15:54:34 +0200
commitfdbda9e3d6564ec908733c7019305f6a3c363a9f (patch)
treec596034156f167e7cfafe41c4a3fc6adda488a0d /server/helpers
parent04de542abd940f9d2ca213fba3c68580c6c9b78a (diff)
downloadPeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.tar.gz
PeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.tar.zst
PeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.zip
Add tests for npm run scripts
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/core-utils.ts11
-rw-r--r--server/helpers/custom-validators/misc.ts2
-rw-r--r--server/helpers/custom-validators/pods.ts1
-rw-r--r--server/helpers/custom-validators/remote/videos.ts1
-rw-r--r--server/helpers/custom-validators/users.ts1
-rw-r--r--server/helpers/custom-validators/videos.ts1
6 files changed, 15 insertions, 2 deletions
diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts
index f8dd45533..2ec7e6515 100644
--- a/server/helpers/core-utils.ts
+++ b/server/helpers/core-utils.ts
@@ -25,8 +25,15 @@ function isTestInstance () {
25} 25}
26 26
27function root () { 27function root () {
28 // We are in /dist/helpers/utils.js 28 // We are in /helpers/utils.js
29 return join(__dirname, '..', '..', '..') 29 const paths = [ __dirname, '..', '..' ]
30
31 // We are under /dist directory
32 if (process.mainModule.filename.endsWith('.ts') === false) {
33 paths.push('..')
34 }
35
36 return join.apply(null, paths)
30} 37}
31 38
32function promisify0<A> (func: (cb: (err: any, result: A) => void) => void): () => Promise<A> { 39function promisify0<A> (func: (cb: (err: any, result: A) => void) => void): () => Promise<A> {
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts
index f6bb02c8e..8d215a416 100644
--- a/server/helpers/custom-validators/misc.ts
+++ b/server/helpers/custom-validators/misc.ts
@@ -1,3 +1,5 @@
1import 'express-validator'
2
1function exists (value: any) { 3function exists (value: any) {
2 return value !== undefined && value !== null 4 return value !== undefined && value !== null
3} 5}
diff --git a/server/helpers/custom-validators/pods.ts b/server/helpers/custom-validators/pods.ts
index f2ca520c0..844bfdf78 100644
--- a/server/helpers/custom-validators/pods.ts
+++ b/server/helpers/custom-validators/pods.ts
@@ -1,4 +1,5 @@
1import * as validator from 'validator' 1import * as validator from 'validator'
2import 'express-validator'
2 3
3import { isArray, exists } from './misc' 4import { isArray, exists } from './misc'
4import { isTestInstance } from '../core-utils' 5import { isTestInstance } from '../core-utils'
diff --git a/server/helpers/custom-validators/remote/videos.ts b/server/helpers/custom-validators/remote/videos.ts
index 49f76e909..e5c76f3ca 100644
--- a/server/helpers/custom-validators/remote/videos.ts
+++ b/server/helpers/custom-validators/remote/videos.ts
@@ -1,3 +1,4 @@
1import 'express-validator'
1import { has, values } from 'lodash' 2import { has, values } from 'lodash'
2 3
3import { 4import {
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts
index 00061f9df..805437efa 100644
--- a/server/helpers/custom-validators/users.ts
+++ b/server/helpers/custom-validators/users.ts
@@ -1,5 +1,6 @@
1import { values } from 'lodash' 1import { values } from 'lodash'
2import * as validator from 'validator' 2import * as validator from 'validator'
3import 'express-validator'
3 4
4import { exists } from './misc' 5import { exists } from './misc'
5import { CONSTRAINTS_FIELDS, USER_ROLES } from '../../initializers' 6import { CONSTRAINTS_FIELDS, USER_ROLES } from '../../initializers'
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts
index 8b3a26644..1d27e47fc 100644
--- a/server/helpers/custom-validators/videos.ts
+++ b/server/helpers/custom-validators/videos.ts
@@ -1,5 +1,6 @@
1import { values } from 'lodash' 1import { values } from 'lodash'
2import * as validator from 'validator' 2import * as validator from 'validator'
3import 'express-validator'
3import 'multer' 4import 'multer'
4 5
5import { 6import {