Javascript 如何将Sinonjs与bruch和卓别林样板一起使用
我从样板开始,但我想在混合中加入西农和昆特。因此,我将它们添加到Javascript 如何将Sinonjs与bruch和卓别林样板一起使用,javascript,coffeescript,sinon,brunch,chaplinjs,Javascript,Coffeescript,Sinon,Brunch,Chaplinjs,我从样板开始,但我想在混合中加入西农和昆特。因此,我将它们添加到bower.json中,并使用bowerinstall安装它们。这一切都非常顺利,但现在我想访问如下功能: Model = require './model' module.exports = class Collection extends Chaplin.Collection # Mixin a synchronization state machine. # _(@prototype).extend Chaplin.
bower.json
中,并使用bowerinstall
安装它们。这一切都非常顺利,但现在我想访问如下功能:
Model = require './model'
module.exports = class Collection extends Chaplin.Collection
# Mixin a synchronization state machine.
# _(@prototype).extend Chaplin.SyncMachine
# initialize: ->
# super
# @on 'request', @beginSync
# @on 'sync', @finishSync
# @on 'error', @unsync
# Use the project base model per default, not Chaplin.Model
model: Model
initialize: ->
@on 'request', @reply
reply: ->
console.log QUnit # this works
console.log Sinon # this error's
console.log 'requested'
更新:
当我使用早午餐构建
手动构建时,出现了错误
error: [Error: Component JSON file
"/Users/Simon/Development/myparcel/data/myparcel/bower_components/sinon/.bower.json"
must have `main` property.
See https://github.com/paulmillr/read-components#README]
因此,我在文件中添加了
“main”:“sinon.js”
,运气不好。您需要再做一些更改,您需要将“sinon.js”
更改为“lib/sinon.js”
,并且
console.log Sinon
到console.log Sinon
因为Sinon使用Sinon
全局非Sinon