Use relative paths when resolving

This commit is contained in:
Kevin Sawicki
2013-09-17 16:15:53 -07:00
parent 671c2750ef
commit 95673b390d
4 changed files with 7 additions and 7 deletions

View File

@@ -219,7 +219,7 @@ describe "RootView", ->
it "creates an edit session for the given path as an item on a new pane, and focuses the pane", ->
editSession = rootView.open('b')
expect(rootView.getActivePane().activeItem).toBe editSession
expect(editSession.getPath()).toBe fsUtils.resolveOnLoadPath('fixtures/dir/b')
expect(editSession.getPath()).toBe require.resolve('./fixtures/dir/b')
expect(rootView.getActivePane().focus).toHaveBeenCalled()
describe "when the changeFocus option is false", ->
@@ -359,6 +359,6 @@ describe "RootView", ->
rootView.eachBuffer(callback)
count = 0
callbackBuffer = null
rootView.open(require.resolve('fixtures/sample.txt'))
rootView.open(require.resolve('./fixtures/sample.txt'))
expect(count).toBe 1
expect(callbackBuffer).toBe rootView.getActiveView().getBuffer()

View File

@@ -28,7 +28,7 @@ describe "the `syntax` global", ->
expect(syntax.selectGrammar("/hu.git/config").name).toBe "Null Grammar"
it "uses the filePath's shebang line if the grammar cannot be determined by the extension or basename", ->
filePath = require.resolve("fixtures/shebang")
filePath = require.resolve("./fixtures/shebang")
expect(syntax.selectGrammar(filePath).name).toBe "Ruby"
it "uses the number of newlines in the first line regex to determine the number of lines to test against", ->
@@ -44,7 +44,7 @@ describe "the `syntax` global", ->
expect(syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Property List (XML)"
it "doesn't read the file when the file contents are specified", ->
filePath = require.resolve("fixtures/shebang")
filePath = require.resolve("./fixtures/shebang")
filePathContents = fsUtils.read(filePath)
spyOn(fsUtils, 'read').andCallThrough()
expect(syntax.selectGrammar(filePath, filePathContents).name).toBe "Ruby"

View File

@@ -8,7 +8,7 @@ describe "Task", ->
spyOn(console, 'error')
spyOn(console, 'warn')
jqueryTask = new Task('fixtures/jquery-task-handler')
jqueryTask = new Task(require.resolve('./fixtures/jquery-task-handler'))
jqueryLoaded = false
jqueryTask.start (loaded) -> jqueryLoaded = loaded
@@ -24,7 +24,7 @@ describe "Task", ->
describe "@once(taskPath, args..., callback)", ->
it "terminates the process after it completes", ->
handlerResult = null
task = Task.once 'fixtures/task-spec-handler', (result) ->
task = Task.once require.resolve('./fixtures/task-spec-handler'), (result) ->
handlerResult = result
processClosed = false

View File

@@ -18,7 +18,7 @@ describe "TextMateGrammar", ->
describe "@loadSync(path)", ->
it "loads grammars from plists", ->
grammar = TextMateGrammar.loadSync(fsUtils.resolveOnLoadPath('fixtures/sample.plist'))
grammar = TextMateGrammar.loadSync(require.resolve('./fixtures/sample.plist'))
expect(grammar.scopeName).toBe "text.plain"
{tokens} = grammar.tokenizeLine("this text is so plain. i love it.")
expect(tokens[0]).toEqual value: "this text is so plain. i love it.", scopes: ["text.plain", "meta.paragraph.text"]