server: upgrade glob in server to get absolute paths of specs for #118

This commit is contained in:
Gleb Bahmutov
2017-06-06 12:03:43 -04:00
parent a5d715f6b4
commit 0e074f4c5e
3 changed files with 34 additions and 4 deletions
+6 -2
View File
@@ -151,6 +151,8 @@ module.exports = {
setNameParts = (file) ->
log("found test file %s", file)
throw new Error("Cannot set parts of file from non-absolute path #{file}") if not path.isAbsolute(file)
{
name: relativePathFromIntegrationFolder(file)
path: relativePathFromProjectRoot(file)
@@ -176,8 +178,10 @@ module.exports = {
## ignored test files glob
.filter(doesNotMatchAllIgnoredPatterns)
.map(setNameParts)
.then (arr) ->
.then (files) ->
log("found %d spec files", files.length)
log(files)
{
integration: arr
integration: files
}
}
+1 -1
View File
@@ -103,7 +103,7 @@
"fs-extra": "2.1.2",
"getos": "^2.8.2",
"gift": "0.9.0",
"glob": "5.0.10",
"glob": "7.1.2",
"graceful-fs": "^4.1.11",
"gulp-util": "^3.0.6",
"hbs": "4.0.0",
+27 -1
View File
@@ -3,13 +3,38 @@ require("../spec_helper")
Promise = require("bluebird")
human = require("human-interval")
path = require("path")
R = require("ramda")
api = require("#{root}lib/api")
config = require("#{root}lib/config")
user = require("#{root}lib/user")
filesUtil = require("#{root}lib/controllers/files")
files = require("#{root}lib/files")
FixturesHelper = require("#{root}/test/support/helpers/fixtures")
filesController = require("#{root}lib/controllers/files")
describe "lib/controllers/files", ->
beforeEach ->
FixturesHelper.scaffold()
@todosPath = FixturesHelper.projectPath("todos")
config.get(@todosPath).then (cfg) =>
@config = cfg
afterEach ->
FixturesHelper.remove()
context "#getTestFiles", ->
checkFoundSpec = (foundSpec) ->
if not path.isAbsolute(foundSpec.absolute)
throw new Error("path to found spec should be absolute #{JSON.stringify(foundSpec)}")
it "returns absolute filenames", ->
filesController
.getTestFiles(@config)
.then (R.prop("integration"))
.then (R.forEach(checkFoundSpec))
describe "lib/files", ->
beforeEach ->
@@ -18,6 +43,7 @@ describe "lib/files", ->
@todosPath = FixturesHelper.projectPath("todos")
config.get(@todosPath).then (cfg) =>
@config = cfg
{@projectRoot} = cfg
afterEach ->