简体   繁体   English

茉莉花与Coffeescript意外的字符串语法错误

[英]Jasmine with Coffeescript Unexpected string Syntax error

I'm trying Jasmine in Coffeescript but when i call jasmine in the terminal, I get this error: 我在Coffeescript中尝试茉莉花,但是当我在终端中调用jasmine ,出现此错误:

/home/luca/tries/sourcemaps-demo/spec/mainSpec.coffee:1
nction (exports, require, module, __filename, __dirname) { describe 'A suite',
                                                                ^^^^^^^^^
SyntaxError: Unexpected string
  at Module._compile (module.js:439:25)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at /home/luca/.nvm/v0.10.35/lib/node_modules/jasmine/lib/jasmine.js:63:5
at Array.forEach (native)
at Jasmine.loadSpecs (/home/luca/.nvm/v0.10.35/lib/node_modules/jasmine/lib/jasmine.js:62:18)
at Jasmine.execute (/home/luca/.nvm/v0.10.35/lib/node_modules/jasmine/lib/jasmine.js:145:8)

This is my spec/support/jasmine.json: 这是我的spec / support / jasmine.json:

{
   "spec_dir": "spec",
   "spec_files": [
     "**/*[sS]pec.coffee"
   ],
   "helpers": [
     "helpers/**/*.coffee"
   ]
}

And this is my spec/mainSpec.coffee: 这是我的spec / mainSpec.coffee:

describe 'A suite', ->
  it 'should return true', ->
    expect(true).toBe true

I'm missing something? 我想念什么吗?

jasmine does not support coffee-script . jasmine不支持coffee-script If You want to write tests in coffee-script , use jasmine-node 如果要用coffee-script编写测试,请使用jasmine-node

$npm install -g jasmine-node
$jasmine-node --coffee spec/
.

Finished in 0.01 seconds
1 test, 1 assertion, 0 failures, 0 skipped

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM