Use relative require paths in specs

This commit is contained in:
Kevin Sawicki 2013-09-17 14:54:33 -07:00
parent 7ad85ee71f
commit c7a0a4bcd9
9 changed files with 13 additions and 13 deletions

View File

@ -1,5 +1,5 @@
require 'atom'
{runSpecSuite} = require 'jasmine-helper'
{runSpecSuite} = require '../spec/jasmine-helper'
atom.openDevTools()

View File

@ -1,5 +1,5 @@
{Site} = require 'telepath'
Environment = require 'environment'
Environment = require './environment'
describe "EditSession replication", ->
[env1, env2, editSession1, editSession2] = []

View File

@ -1,6 +1,6 @@
{Site} = require 'telepath'
Editor = require 'editor'
Environment = require 'environment'
Environment = require './environment'
describe "Editor replication", ->
[env1, env2, editSession1, editSession2, editor1, editor2] = []

View File

@ -5,7 +5,7 @@ module.exports.runSpecSuite = (specSuite, logErrors=true) ->
require 'jasmine-focused'
$ = require 'jquery'
TimeReporter = require 'time-reporter'
TimeReporter = require './time-reporter'
timeReporter = new TimeReporter()
if atom.getLoadSettings().exitWhenDone
@ -20,7 +20,7 @@ module.exports.runSpecSuite = (specSuite, logErrors=true) ->
timeReporter.logLongestSpecs 10, (line) -> process.stdout.write("#{line}\n")
atom.exit(runner.results().failedCount > 0 ? 1 : 0)
else
AtomReporter = require 'atom-reporter'
AtomReporter = require './atom-reporter'
reporter = new AtomReporter()
require specSuite

View File

@ -2,7 +2,7 @@
{View} = require 'space-pen'
PaneContainer = require 'pane-container'
Pane = require 'pane'
Environment = require 'environment'
Environment = require './environment'
describe "PaneContainer replication", ->
[env1, env2, envConnection, container1, container2, pane1a, pane1b, pane1c] = []

View File

@ -1,10 +1,10 @@
try
require 'atom'
atom.show()
{runSpecSuite} = require 'jasmine-helper'
{runSpecSuite} = require './jasmine-helper'
document.title = "Spec Suite"
runSpecSuite "spec-suite"
runSpecSuite './spec-suite'
catch e
console.error(e.stack ? e)
atom.exit(1) if atom.getLoadSettings().exitWhenDone

View File

@ -22,7 +22,7 @@ clipboard = require 'clipboard'
atom.loadBaseStylesheets()
requireStylesheet '../static/jasmine'
fixturePackagesPath = fsUtils.resolveOnLoadPath('fixtures/packages')
fixturePackagesPath = path.resolve(__dirname, './fixtures/packages')
config.packageDirPaths.unshift(fixturePackagesPath)
keymap.loadBundledKeymaps()
[bindingSetsToRestore, bindingSetsByFirstKeystrokeToRestore] = []
@ -39,7 +39,7 @@ jasmine.getEnv().defaultTimeoutInterval = 5000
beforeEach ->
jQuery.fx.off = true
specDirectory = atom.getLoadSettings().specDirectory ? fsUtils.resolveOnLoadPath("spec")
specDirectory = atom.getLoadSettings().specDirectory ? __dirname
window.project = new Project(path.join(specDirectory, 'fixtures'))
window.resetTimeouts()
@ -247,5 +247,5 @@ $.fn.textInput = (data) ->
event = jQuery.event.fix(event)
$(this).trigger(event)
unless fsUtils.md5ForPath(require.resolve('fixtures/sample.js')) == "dd38087d0d7e3e4802a6d3f9b9745f2b"
unless fsUtils.md5ForPath(require.resolve('./fixtures/sample.js')) == "dd38087d0d7e3e4802a6d3f9b9745f2b"
throw new Error("Sample.js is modified")

View File

@ -6,7 +6,7 @@ measure 'spec suite require time', ->
path = require 'path'
_ = require 'underscore'
Git = require 'git'
require 'spec-helper'
require './spec-helper'
requireSpecs = (specDirectory, specType) ->
for specFilePath in fsUtils.listTreeSync(specDirectory) when /-spec\.coffee$/.test specFilePath

View File

@ -276,7 +276,7 @@ class AtomApplication
if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath)
resourcePath = @resourcePath
bootstrapScript = 'spec-bootstrap'
bootstrapScript = require.resolve('../spec/spec-bootstrap')
isSpec = true
devMode = true
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory})