-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec-suite.coffee
33 lines (26 loc) · 1.12 KB
/
spec-suite.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
fs = require 'fs'
require 'window'
measure 'spec suite require time', ->
fsUtils = require 'fs-utils'
path = require 'path'
require 'spec-helper'
requireSpecs = (directoryPath, specType) ->
for specPath in fsUtils.listTreeSync(path.join(directoryPath, 'spec')) when /-spec\.coffee$/.test specPath
require specPath
setSpecType = (specType) ->
for spec in jasmine.getEnv().currentRunner().specs() when not spec.specType?
spec.specType = specType
# Run core specs
requireSpecs(window.resourcePath)
setSpecType('core')
# Run bundled package specs
if fsUtils.isDirectorySync(config.nodeModulesDirPath)
for packageName in fs.readdirSync(config.nodeModulesDirPath)
packagePath = path.join(config.nodeModulesDirPath, packageName)
requireSpecs(packagePath, 'bundled') if atom.isInternalPackage(packagePath)
setSpecType('bundled')
# Run user package specs
for packageDirPath in config.userPackageDirPaths when fsUtils.isDirectorySync(packageDirPath)
for packageName in fs.readdirSync(packageDirPath)
requireSpecs(path.join(packageDirPath, packageName))
setSpecType('user')