mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-06 23:26:25 +03:00
Store spec directory on required specs
This allows the project to be configured based on the spec being run.
This commit is contained in:
parent
f60ead03d2
commit
0b22d99fad
@ -37,18 +37,20 @@ jasmine.getEnv().defaultTimeoutInterval = 5000
|
|||||||
|
|
||||||
specPackageName = null
|
specPackageName = null
|
||||||
specPackagePath = null
|
specPackagePath = null
|
||||||
|
specProjectPath = null
|
||||||
|
|
||||||
if specDirectory = atom.getLoadSettings().specDirectory
|
if specDirectory = atom.getLoadSettings().specDirectory
|
||||||
specPackagePath = path.resolve(specDirectory, '..')
|
specPackagePath = path.resolve(specDirectory, '..')
|
||||||
try
|
try
|
||||||
specPackageName = fs.readObjectSync(path.join(specPackagePath, 'package.json'))?.name
|
specPackageName = fs.readObjectSync(path.join(specPackagePath, 'package.json'))?.name
|
||||||
else
|
specProjectPath = path.join(specDirectory, 'fixtures')
|
||||||
specDirectory = __dirname
|
|
||||||
specProjectPath = path.join(specDirectory, 'fixtures')
|
|
||||||
|
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
$.fx.off = true
|
$.fx.off = true
|
||||||
atom.project = new Project(specProjectPath)
|
if specProjectPath
|
||||||
|
atom.project = new Project(specProjectPath)
|
||||||
|
else
|
||||||
|
atom.project = new Project(path.join(@specDirectory, 'fixtures'))
|
||||||
window.project = atom.project
|
window.project = atom.project
|
||||||
|
|
||||||
window.resetTimeouts()
|
window.resetTimeouts()
|
||||||
|
@ -7,14 +7,24 @@ measure 'spec suite require time', ->
|
|||||||
for specFilePath in fs.listTreeSync(specDirectory) when /-spec\.coffee$/.test specFilePath
|
for specFilePath in fs.listTreeSync(specDirectory) when /-spec\.coffee$/.test specFilePath
|
||||||
require specFilePath
|
require specFilePath
|
||||||
|
|
||||||
|
# Set spec directory on spec for setting up the project in spec-helper
|
||||||
|
specs = jasmine.getEnv().currentRunner().specs()
|
||||||
|
if specs.length > 0
|
||||||
|
for index in [specs.length-1..0]
|
||||||
|
break if specs[index].specDirectory?
|
||||||
|
specs[index].specDirectory = specDirectory
|
||||||
|
|
||||||
setSpecType = (specType) ->
|
setSpecType = (specType) ->
|
||||||
for spec in jasmine.getEnv().currentRunner().specs() when not spec.specType?
|
specs = jasmine.getEnv().currentRunner().specs()
|
||||||
spec.specType = specType
|
return if specs.length is 0
|
||||||
|
for index in [specs.length-1..0]
|
||||||
|
break if specs[index].specType?
|
||||||
|
specs[index].specType = specType
|
||||||
|
|
||||||
runAllSpecs = ->
|
runAllSpecs = ->
|
||||||
# Only run core specs when resource path is the Atom repository
|
# Only run core specs when resource path is the Atom repository
|
||||||
if Git.exists(window.resourcePath)
|
if Git.exists(window.resourcePath)
|
||||||
requireSpecs(path.join(window.resourcePath, 'spec'))
|
# requireSpecs(path.join(window.resourcePath, 'spec'))
|
||||||
setSpecType('core')
|
setSpecType('core')
|
||||||
|
|
||||||
fixturesPackagesPath = path.join(__dirname, 'fixtures', 'packages')
|
fixturesPackagesPath = path.join(__dirname, 'fixtures', 'packages')
|
||||||
|
Loading…
Reference in New Issue
Block a user