mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Use fs.readdirSync() for listing package directories
Previously fsUtils.listTreeSync() was used which returns every path in the tree, not just paths directly underneath the root path. This speeds up the spec suite require time by not stat'ing the entire node_modules directory.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
fs = require 'fs'
|
||||
|
||||
require 'window'
|
||||
|
||||
measure 'spec suite require time', ->
|
||||
@@ -18,11 +20,14 @@ measure 'spec suite require time', ->
|
||||
setSpecType('core')
|
||||
|
||||
# Run bundled package specs
|
||||
for packagePath in fsUtils.listTreeSync(config.nodeModulesDirPath) when atom.isInternalPackage(packagePath)
|
||||
requireSpecs(packagePath, '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
|
||||
for packagePath in fsUtils.listTreeSync(config.userPackagesDirPath)
|
||||
requireSpecs(packagePath, 'user')
|
||||
setSpecType('user')
|
||||
if fsUtils.isDirectorySync(config.userPackagesDirPath)
|
||||
for packageName in fs.readdirSync(config.userPackagesDirPath)
|
||||
requireSpecs(path.join(config.userPackagesDirPath, packageName))
|
||||
setSpecType('user')
|
||||
|
||||
Reference in New Issue
Block a user