JavaScript tests with Mocha and jspm

It’s no secret that I love jspm. I think it does everything right. I think Webpack requires far too much configuration. jspm is also much more standards-oriented, so I expect the patterns I learn and develop to last much longer, which is something I sorely need in JavaScript development. However, testing it is difficult bordering on silly. I just spent three days trying to get tests to work, and the solution I have for you isn’t perfect.


React and jspm

I’ve been tinkering with React a lot lately; I am really loving it. Since I still believe that jspm offers a better development and bundling experience than WebPack (unless you need hot module reloading), I spend some time this week getting a solid project template down for React and jspm. Directory Structure Let’s just jump straight to the solution, and then break down the reasons. Project |--assets/ | |--css/ | |--fonts/ | |--images/ | +--stylus/ |--dist/ +--built.


jspm, jQuery Plugins, and ES6

jspm is a new package manager for JavaScript fornt-ends that comes with a universal module loading system. It integrates nicely with npm by adding a jspm property to the package.json that specifies what the jspm dependencies are. Mine looks like this: "jspm": { "directories": { "baseURL": "client" }, "dependencies": { "Magnific-Popup": "github:dimsemenov/Magnific-Popup@^1.0.0", "aurelia-bootstrapper": "^0.8.0", "aurelia-http-client": "^0.4.1", "bootstrap": "^3.3.1", "font-awesome": "^4.2.0", "jquery": "^2.1.3" } } One of the really cool things about jspm is that, while it uses npm to load packages, it allows multiple endpoints to be defined.