mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 18:24:09 +03:00
23 lines
703 B
CoffeeScript
23 lines
703 B
CoffeeScript
Task = require '../src/task'
|
|
|
|
describe "Task", ->
|
|
describe "@once(taskPath, args..., callback)", ->
|
|
it "terminates the process after it completes", ->
|
|
handlerResult = null
|
|
task = Task.once require.resolve('./fixtures/task-spec-handler'), (result) ->
|
|
handlerResult = result
|
|
|
|
processClosed = false
|
|
processErrored = false
|
|
childProcess = task.childProcess
|
|
spyOn(childProcess, 'kill').andCallThrough()
|
|
task.childProcess.on 'error', -> processErrored = true
|
|
|
|
waitsFor ->
|
|
handlerResult?
|
|
|
|
runs ->
|
|
expect(handlerResult).toBe 'hello'
|
|
expect(childProcess.kill).toHaveBeenCalled()
|
|
expect(processErrored).toBe false
|