我有以下cakefile任務來運行硒測試,它運行成功,到達測試結束但不會退出。咖啡腳本cakefile任務沒有完成
muffin = require 'muffin'
wrench = require 'wrench'
http = require 'http'
fs = require 'fs'
spawn = require('child_process').spawn
exec = require('child_process').exec
task 'selenium', 'run selenium tests', (options) ->
sel = require './test/selenium'
app = spawn 'node', ['app.js']
app.stdout.on 'data', (data) ->
if /listening on port/.test data
selenium = spawn 'selenium'
selenium.stdout.on 'data', (data) ->
console.log 'stdout: ' + data
if /Started.*jetty.Server/.test data
sel.run ->
app.stdin.end()
selenium.stdin.end()
console.log 'completed Selenium Tests'
有沒有辦法讓我完成任務?我得到控制檯中記錄的「已完成的Selenium測試」。
如果你採用相同的代碼(沒有'task'selenium''位),並在'.coffee'而不是'Cakefile'中運行,你會得到相同的行爲,對吧? –
我已經將所有這些代碼轉換爲香草javascript和外部的自動運行的cakefile,並且獲得相同的結果 –