【发布时间】:2015-01-31 22:14:03
【问题描述】:
我正在尝试检查(在单元测试中)某个特定对象是否是 ChildProcess,但我似乎无法获得对该类的引用(此处为 https://github.com/joyent/node/blob/7c0419730b237dbfa0ec4e6fb33a99ff01825a8f/lib/child_process.js)
我想做的事情是这样的
selenium = require('selenium-standalone')
spawnOptions = { stdio: 'pipe' }
seleniumArgs = ['-Dwebdriver.chrome.driver=./node_modules/nodewebkit/nodewebkit/chromedriver']
@server = selenium(spawnOptions, seleniumArgs)
expect(server).to.be.an.instanceof(ChildProcess)
但我似乎不知道从哪里获得对 ChildProcess 的引用
更新:根据提供的答案,我现在正在使用以下方法进行测试:
it 'start()', (done)->
selenium.start.assert_Is_Function()
selenium.start ->
selenium.server.assert_Is_Not_Null()
selenium.server.constructor.assert_Is_Function()
selenium.server.constructor.name.assert_Is('ChildProcess')
done()
【问题讨论】:
标签: node.js coffeescript mocha.js