fuse-box-contrib / karma-fuse-box Goto Github PK
View Code? Open in Web Editor NEWUse FuseBox to preprocess files in Karma.
License: MIT License
Use FuseBox to preprocess files in Karma.
License: MIT License
Hi,
Got a problem I can't seem to get around, hoping you can help. I'm new to Karma/Mocha/Fusebox etc so maybe it's something obvious I'm not getting.
I've set up my karma.config file according to the example, but when I start kama, I get an error in the Chrome dev tools:
I stepped through the code behind the error, but since it's minified I can't really tell exactly what's going on, but it appears to be looking for a package 'glob' in 'mocha' that doesn't exist for some reason.
My project is set up like so:
src/
tests/
--My_test.ts
karma.config.js
package.json
tsconfig.json
karma.config.js:
const path = require("path");
module.exports = config => {
config.set({
basePath: "",
files: [
{ pattern: "tests/My_test.ts", watched: false }
],
preprocessors: {
"tests/My_test.ts": [ "fusebox" ]
},
fuseboxInstructions: "+ tests/My_test.ts",
fusebox: {
homeDir: path.join(process.cwd(), "tests/"),
cache:false,
},
mime: {
"text/x-typescript": ["ts", "tsx"]
},
browsers: ['Chrome'],
logLevel: config.LOG_DEBUG,
browserConsoleLogOptions: {
level: "debug",
terminal: true
}
});
};
My_test.ts:
import { assert } from "chai";
import { describe, it } from "mocha";
describe("This is my test", function(){
it("should complete this test", function(){
return assert.isTrue(true);
});
});
In package.json:
"devDependencies": {
"@types/bluebird": "^3.5.24",
"@types/chai": "^4.1.4",
"@types/chai-as-promised": "^7.1.0",
"@types/karma": "^1.7.6",
"@types/mocha": "^5.2.5",
"@types/moment": "^2.13.0",
"@types/sharepoint": "^2016.1.1",
"@types/sinon": "^5.0.2",
"@types/sinon-chai": "^3.2.0",
"bluebird": "^3.5.2",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"fuse-box": "^3.5.0",
"karma": "^3.0.0",
"karma-browserify": "^5.3.0",
"karma-chai": "^0.1.0",
"karma-chai-as-promised": "^0.1.2",
"karma-chrome-launcher": "^2.2.0",
"karma-edge-launcher": "^0.4.2",
"karma-firefox-launcher": "^1.1.0",
"karma-fuse-box": "^1.1.0",
"karma-ie-launcher": "^1.0.0",
"karma-mocha": "^1.3.0",
"karma-sinon": "^1.0.5",
"karma-sinon-chai": "^2.0.2",
"mocha": "^5.2.0",
"moment": "^2.22.2",
"node-watch": "^0.5.8",
"opn": "^5.3.0",
"sinon": "^6.2.0",
"sinon-chai": "^3.2.0",
"typedoc": "^0.12.0",
"typedoc-plugin-external-module-name": "^1.1.3",
"typescript": "^3.0.3",
"uglify-js": "^3.4.9",
},
Just to try and narrow down where the problem might be, I rewrote My_test.ts as a plain javascript file and used Browserify as the preprocessor instead of Fuse Box and the test ran without issue, so I'm guessing it's a FuseBox or Karma-Fuse-Box issue?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.