如何使用jasmine-node和RequireJS正确运行茉莉花测试?如何使用RequireJS运行茉莉花节点测试
我已经尝试过这样的事情,但不工作(CoffeeScript的):
requirejs = require 'requirejs'
requirejs.config { baseUrl: __dirname + '/../' }
requirejs ['MyClasses', 'FooClass'], (MyClasses, FooClass) ->
describe "someProp", ->
it "should be true", ->
expect(MyClasses.FooClass.someProp).toEqual true
0秒0的测试,0断言,0失败
我的目标是编写模块化类成品使用RequireJS,CoffeeScript和类必须使用jasmine-node(CI服务器)进行测试。
我该怎么做? 谢谢!
编辑:
我执行与命令测试(在目录与测试):
jasmine-node ./
你是怎么执行茉莉花的?如果你在'requirejs'块中放置一个'console.log'hello',它会打印吗?在'它'里面?在requirejs块之外怎么样? –
requirejs块的'Outside'将首先打印“hello”。第二个是“require”内部的“hello”块,“it”块中的“hello”不打印。 –
你尝试过'jasmine-node --coffee --verbose。/'?另外,你的spec文件名为?我认为它必须在“Foo.spec.coffee”中包含“spec”作为名称的一部分。 –