Skip to content

Commit

Permalink
Use fs.resolveOnLoadPath() instead of require.resolve()
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsawicki committed Mar 12, 2013
1 parent 8b82c06 commit 96a9499
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 1 addition & 2 deletions spec/spec-helper.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ RootView = require 'root-view'
Git = require 'git'
requireStylesheet "jasmine.css"
fixturePackagesPath = fs.resolveOnLoadPath('fixtures/packages')
require.paths.unshift(fixturePackagesPath)
keymap.loadBundledKeymaps()
[bindingSetsToRestore, bindingSetsByFirstKeystrokeToRestore] = []

Expand All @@ -30,7 +29,7 @@ jasmine.getEnv().defaultTimeoutInterval = 5000

beforeEach ->
jQuery.fx.off = true
window.project = new Project(require.resolve('fixtures'))
window.project = new Project(fs.resolveOnLoadPath('fixtures'))
window.git = Git.open(project.getPath())
window.project.on 'path-changed', ->
window.git?.destroy()
Expand Down
3 changes: 1 addition & 2 deletions spec/spec-suite.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
fs = require 'fs-utils'
require 'spec-helper'


# Run core specs
for path in fs.listTree(require.resolve("spec")) when /-spec\.coffee$/.test path
for path in fs.listTree(fs.resolveOnLoadPath("spec")) when /-spec\.coffee$/.test path
require path

# Run extension specs
Expand Down
10 changes: 9 additions & 1 deletion vendor/jasmine-helper.coffee
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
window.nakedLoad = (file) ->
fs = require 'fs-utils'
file = require.resolve(file)
code = fs.read(file)
if fs.extension(file) is '.coffee'
require('coffee-script').eval(code, filename: file)
else
window.eval("#{code}\n//@ sourceURL=#{file}")

module.exports.runSpecSuite = (specSuite, logErrors=true) ->
{$$} = require 'space-pen'
nakedLoad 'jasmine'
Expand All @@ -14,7 +23,6 @@ module.exports.runSpecSuite = (specSuite, logErrors=true) ->
else
new AtomReporter()


require specSuite
jasmineEnv = jasmine.getEnv()
jasmineEnv.addReporter(reporter)
Expand Down

0 comments on commit 96a9499

Please sign in to comment.