1
0
mirror of https://github.com/S2-/gitlit synced 2025-08-04 05:10:05 +02:00

update dependencies

This commit is contained in:
s2
2018-10-09 09:51:34 +02:00
parent 4fcc873901
commit da4083f574
1112 changed files with 23205 additions and 21697 deletions

View File

@@ -1,6 +1,5 @@
'use strict'
const fs = require('fs-extra')
const path = require('path')
const prune = require('../prune')
const test = require('ava')
@@ -10,15 +9,13 @@ function checkDependency (t, resourcesPath, moduleName, moduleExists) {
const assertion = moduleExists ? 'should' : 'should NOT'
const message = `module dependency '${moduleName}' ${assertion} exist under app/node_modules`
const modulePath = path.join(resourcesPath, 'app', 'node_modules', moduleName)
return fs.pathExists(modulePath)
.then(exists => t.is(moduleExists, exists, message))
return util.assertPathExistsCustom(t, modulePath, moduleExists, message)
.then(() => modulePath)
}
function assertDependencyExists (t, resourcesPath, moduleName) {
return checkDependency(t, resourcesPath, moduleName, true)
.then(modulePath => fs.stat(modulePath))
.then(stats => t.true(stats.isDirectory(), 'module is a directory'))
.then(modulePath => util.assertDirectory(t, modulePath, 'module is a directory'))
}
function createPruneOptionTest (t, baseOpts, prune, testMessage) {
@@ -56,10 +53,13 @@ util.testSinglePlatform('prune electron in dependencies', (t, baseOpts) => {
util.testSinglePlatform('prune: false test', createPruneOptionTest, false,
'package.json devDependency should exist under app/node_modules')
test('isModule only detects modules inside a node_modules parent folder', t =>
test('isModule properly detects module folders', t =>
prune.isModule(util.fixtureSubdir(path.join('prune-is-module', 'node_modules', 'module')))
.then(isModule => {
t.true(isModule, 'module folder should be detected as module')
return prune.isModule(util.fixtureSubdir(path.join('prune-is-module', 'node_modules', 'module', 'not-module')))
}).then(isModule => t.false(isModule, 'not-module folder should not be detected as module'))
}).then(isModule => {
t.false(isModule, 'not-module subfolder should not be detected as module')
return prune.isModule(util.fixtureSubdir(path.join('prune-is-module', 'node_modules', '@user', 'namespaced')))
}).then(isModule => t.true(isModule, '@user/namespaced folder should be detected as module'))
)