diff --git a/spec/spec-suite.coffee b/spec/spec-suite.coffee index fd047243d..6ef97bac3 100644 --- a/spec/spec-suite.coffee +++ b/spec/spec-suite.coffee @@ -1,10 +1,10 @@ +fs = require 'fs' + require 'window' measure 'spec suite require time', -> - fs = require 'fs' fsUtils = require 'fs-utils' path = require 'path' - _ = require 'underscore' require 'spec-helper' requireSpecs = (directoryPath, specType) -> @@ -19,20 +19,15 @@ measure 'spec suite require time', -> requireSpecs(window.resourcePath) setSpecType('core') - fixturesPackagesPath = fsUtils.resolveOnLoadPath('fixtures/packages') - packagePaths = atom.getAvailablePackageNames().map (packageName) -> atom.resolvePackagePath(packageName) - packagePaths = _.groupBy packagePaths, (packagePath) -> - if packagePath.indexOf("#{fixturesPackagesPath}#{path.sep}") is 0 - 'fixtures' - else if packagePath.indexOf("#{window.resourcePath}#{path.sep}") is 0 - 'bundled' - else - 'user' - # Run bundled package specs - requireSpecs(packagePath) for packagePath in packagePaths.bundled - setSpecType('bundled') + 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 - requireSpecs(packagePath) for packagePath in packagePaths.user - setSpecType('user') + for packageDirPath in config.userPackageDirPaths when fsUtils.isDirectorySync(packageDirPath) + for packageName in fs.readdirSync(packageDirPath) + requireSpecs(path.join(packageDirPath, packageName)) + setSpecType('user') diff --git a/src/app/config.coffee b/src/app/config.coffee index ec6abaa57..ecd42faf4 100644 --- a/src/app/config.coffee +++ b/src/app/config.coffee @@ -12,8 +12,8 @@ nodeModulesDirPath = path.join(resourcePath, "node_modules") bundledThemesDirPath = path.join(resourcePath, "themes") userThemesDirPath = path.join(configDirPath, "themes") userPackagesDirPath = path.join(configDirPath, "packages") -packageDirPaths = [userPackagesDirPath] -packageDirPaths.unshift(path.join(configDirPath, "dev", "packages")) if atom.getLoadSettings().devMode +userPackageDirPaths = [userPackagesDirPath] +userPackageDirPaths.unshift(path.join(configDirPath, "dev", "packages")) if atom.getLoadSettings().devMode userStoragePath = path.join(configDirPath, "storage") # Public: Handles all of Atom's configuration details. @@ -26,8 +26,8 @@ class Config themeDirPaths: [userThemesDirPath, bundledThemesDirPath] bundledPackageDirPaths: [nodeModulesDirPath] nodeModulesDirPath: nodeModulesDirPath - packageDirPaths: packageDirPaths - userPackagesDirPath: userPackagesDirPath + packageDirPaths: _.clone(userPackageDirPaths) + userPackageDirPaths: userPackageDirPaths userStoragePath: userStoragePath lessSearchPaths: [path.join(resourcePath, 'static'), path.join(resourcePath, 'vendor')] defaultSettings: null