So diesen Fehler Ich habe bei dem Versuch, das Karma mit Jasmin und webpack auszuführen:Karma wirft jasmineRequire nicht Fehler mit webpack und Jasmin
Uncaught ReferenceError: jasmineRequire is not defined at node_modules/karma-jasmine/lib/boot.js:116
Ich dachte, es mein Projekt war so habe ich beschlossen, Erstellen Sie eine neue und hier ist die folgende Konfiguration dafür.
Ich habe das gleiche Problem mit dieser Konfiguration. Hat jemand eine Idee?
Für webpack:
const path = require("path");
module.exports = {
entry: './src/source1.js',
output: {
path: path.resolve("./dist")
}
}
Für Karma:
const webpackConfig = require("./webpack.config");
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
webpack: webpackConfig,
files: [
'test/t1.js'
],
exclude: [
],
preprocessors: {
"**/*.js": ["webpack"]
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
concurrency: Infinity
})
}
Ich habe einen Test/t1.js-Datei wie folgt:
// import { add } from "../src/source1";
function add(x, y) {
return x + y;
}
describe("source1",() => {
describe("add",() => {
it("adds 41 + 1",() => {
expect(add(41, 1)).toBe(42);
});
});
});
Und hier ist meine package.json Datei :
{
"name": "projects",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"jasmine-core": "^2.6.2",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.1.1",
"karma-jasmine": "^1.1.0",
"karma-webpack": "^2.0.3",
"webpack": "^2.5.1"
}
}