From 599a2ad02150868b9c5059f3fa93e5e2f0963d7b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 9 Aug 2013 12:21:56 -0700 Subject: [PATCH] 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 --- spec/atom-reporter.coffee | 57 ++++++++++++++++++++++++++++++--------- spec/spec-suite.coffee | 25 +++++++++++------ src/app/config.coffee | 2 ++ 3 files changed, 63 insertions(+), 21 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 1510d595c..f3d9cdc54 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -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++ diff --git a/spec/spec-suite.coffee b/spec/spec-suite.coffee index ade1e6262..f0d977596 100644 --- a/spec/spec-suite.coffee +++ b/spec/spec-suite.coffee @@ -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') diff --git a/src/app/config.coffee b/src/app/config.coffee index 69761c1e0..20c2afbf7 100644 --- a/src/app/config.coffee +++ b/src/app/config.coffee @@ -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