Quixote看起来很酷。在与Karma合作时遇到了一些麻烦。我尝试模仿Bjorn's example,但收到此错误:
Error: Mismatched anonymous define() module: function () {var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
在我的karma.conf.js中,我有:
files: [
'www/latest/tests/lib/jasmine-beforeAll.js',
'www/latest/tests/lib/sinon-1.7.3.js',
'www/latest/tests/test-main.js',
{pattern: 'www/latest/vendor/**/*.js', included: false},
{pattern: 'www/latest/app/**/*.js', included: false},
{pattern: 'www/latest/tests/lib/*.js', included: false},
{pattern: 'www/latest/tests/specs/**/*.js', included: false},
'node_modules/quixote/dist/*.js'
],
然后在我的测试中,我有
var quixote = require("../../../../node_modules/quixote/dist/quixote.js");
(这似乎是多余的,因为在文件哈希中使用Quixote会使其全局可用但是想要遵循Bjorn的例子来写信)。
答案 0 :(得分:1)
这是我制作的插件,如果它不适合你,请提交门票。 https://github.com/woldie/karma-quixote
npm install --save-dev karma-quixote