在vows文件中使用require.config

时间:2013-10-20 00:08:14

标签: javascript node.js unit-testing requirejs vows

我正在尝试设置在index.html文档中设置的需求,以便没有任何问题...由于某种原因,vowsjs抱怨require.config ......

也许是在使用旧的requirejs版本? 发誓0.7.0

(ProjectEnv)obitusis@8675309 ~../static/js: sudo vows test_models.js

../static/js/test_models.js:1
(function (exports, require, module, __filename, __dirname) { require.config({
                                                                      ^
TypeError: Object function require(path) {
    return self.require(path);
  } has no method 'config'
    at Object.<anonymous> (../static/j
s/test_models.js:1:71)
    at Module._compile (module.js:456:26)
    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 ProjectEnv/lib/node_modules/vows/bin/vow
s:567:19
    at Array.reduce (native)
    at importSuites (ProjectEnv/lib/node_module
s/vows/bin/vows:560:18)

1 个答案:

答案 0 :(得分:0)

认为我已经修好了...看起来我需要......

var require = require('requirejs')

更新

var requirejs = require('requirejs') // guess their require ain't compatible

查看:Building node modules with AMD or RequireJS了解详情。