Group specs into four sections

1. Core specs located in spec/
2. Internal package specs in src/packages
3. Bundled package specs in node_modules
4. User package specs in ~/.atom/packages
This commit is contained in:
Kevin Sawicki 2013-08-09 12:21:56 -07:00
parent db649798ef
commit 599a2ad021
3 changed files with 63 additions and 21 deletions

View File

@ -21,10 +21,18 @@ class AtomReporter extends View
@div id: 'HTMLReporter', class: 'jasmine_reporter', =>
@div outlet: 'specPopup', class: "spec-popup"
@div outlet: "suites"
@div outlet: 'coreHeader', class: 'symbolHeader'
@ul outlet: 'coreSummary', class: 'symbolSummary list-unstyled'
@div outlet: 'packagesHeader', class: 'symbolHeader'
@ul outlet: 'packagesSummary', class: 'symbolSummary list-unstyled'
@div outlet: 'coreArea', =>
@div outlet: 'coreHeader', class: 'symbolHeader'
@ul outlet: 'coreSummary', class: 'symbolSummary list-unstyled'
@div outlet: 'internalArea', =>
@div outlet: 'internalHeader', class: 'symbolHeader'
@ul outlet: 'internalSummary', class: 'symbolSummary list-unstyled'
@div outlet: 'bundledArea', =>
@div outlet: 'bundledHeader', class: 'symbolHeader'
@ul outlet: 'bundledSummary', class: 'symbolSummary list-unstyled'
@div outlet: 'userArea', =>
@div outlet: 'userHeader', class: 'symbolHeader'
@ul outlet: 'userSummary', class: 'symbolSummary list-unstyled'
@div outlet: "status", class: 'status', =>
@div outlet: "time", class: 'time'
@div outlet: "specCount", class: 'spec-count'
@ -122,18 +130,41 @@ class AtomReporter extends View
addSpecs: (specs) ->
coreSpecs = 0
packageSpecs = 0
internalPackageSpecs = 0
bundledPackageSpecs = 0
userPackageSpecs = 0
for spec in specs
symbol = $$ -> @li class: "spec-summary pending spec-summary-#{spec.id}"
if spec.coreSpec
coreSpecs++
@coreSummary.append symbol
else
packageSpecs++
@packagesSummary.append symbol
switch spec.specType
when 'core'
coreSpecs++
@coreSummary.append symbol
when 'internal'
internalPackageSpecs++
@internalSummary.append symbol
when 'bundled'
bundledPackageSpecs++
@bundledSummary.append symbol
when 'user'
userPackageSpecs++
@userSummary.append symbol
@coreHeader.text("Core Specs (#{coreSpecs}):")
@packagesHeader.text("Package Specs (#{packageSpecs}):")
if coreSpecs > 0
@coreHeader.text("Core Specs (#{coreSpecs}):")
else
@coreArea.hide()
if internalPackageSpecs > 0
@internalHeader.text("Internal Package Specs (#{internalPackageSpecs}):")
else
@internalArea.hide()
if bundledPackageSpecs > 0
@bundledHeader.text("Bundled Package Specs (#{bundledPackageSpecs}):")
else
@bundledArea.hide()
if userPackageSpecs > 0
@userHeader.text("User Package Specs (#{userPackageSpecs}):")
else
@userArea.hide()
specStarted: (spec) ->
@runningSpecCount++

View File

@ -5,14 +5,23 @@ measure 'spec suite require time', ->
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
for spec in jasmine.getEnv().currentRunner().specs() when not spec.specType?
spec.specType = specType
# Run core specs
for specPath in fsUtils.listTreeSync(fsUtils.resolveOnLoadPath("spec")) when /-spec\.coffee$/.test specPath
require specPath
requireSpecs(window.resourcePath, 'core')
spec.coreSpec = true for spec in jasmine.getEnv().currentRunner().specs()
# Run internal package specs
for packagePath in fsUtils.listTreeSync(config.bundledPackagesDirPath)
requireSpecs(packagePath, 'internal')
# Run extension specs
for packageDirPath in config.packageDirPaths
for packagePath in fsUtils.listSync(packageDirPath)
for specPath in fsUtils.listTreeSync(path.join(packagePath, "spec")) when /-spec\.coffee$/.test specPath
require specPath
# Run bundled package specs
for packagePath in fsUtils.listTreeSync(config.nodeModulesDirPath) when atom.isInternalPackage(packagePath)
requireSpecs(packagePath, 'bundled')
# Run user package specs
for packagePath in fsUtils.listTreeSync(config.userPackagesDirPath)
requireSpecs(packagePath, 'user')

View File

@ -24,6 +24,8 @@ class Config
configDirPath: configDirPath
themeDirPaths: [userThemesDirPath, bundledThemesDirPath]
bundledPackageDirPaths: [bundledPackagesDirPath, nodeModulesDirPath]
bundledPackagesDirPath: bundledPackagesDirPath
nodeModulesDirPath: nodeModulesDirPath
packageDirPaths: [userPackagesDirPath, bundledPackagesDirPath]
userPackagesDirPath: userPackagesDirPath
userStoragePath: userStoragePath