Skip to content

Instantly share code, notes, and snippets.

@brianmhunt
Last active August 29, 2015 14:25
Show Gist options
  • Save brianmhunt/e9b54d35af5c6537e3c8 to your computer and use it in GitHub Desktop.
Save brianmhunt/e9b54d35af5c6537e3c8 to your computer and use it in GitHub Desktop.
MWE re. karma-browserify#137

Run npm install then gulp && karma start to try out the tests.

gulp = require('gulp')
browserify = require('browserify')
source = require('vinyl-source-stream')
gulp.task('default', function () {
var bify = browserify({
entries: './source.js',
debug: true
})
.transform(require('babelify'))
.bundle()
.pipe(source("./dest.js"))
.pipe(gulp.dest('./'))
})
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai'],
files: [ 'dest.js' ],
exclude: [ ],
preprocessors: { },
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
})
}
{
"name": "karma-issue-1495",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"babelify": "^6.1.3",
"browserify": "^11.0.0",
"chai": "^3.2.0",
"gulp": "^3.9.0",
"karma": "^0.13.3",
"karma-browserify": "^4.2.1",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^0.2.0",
"karma-mocha": "^0.2.0",
"vinyl-source-stream": "^1.1.0"
},
"devDependencies": {
"karma-mocha": "^0.2.0",
"mocha": "^2.2.5"
}
}
// A file in es6
//
class Foo {
constructor() { }
boo() {
chai.assert.equal("The line is", "7?")
}
}
describe('test', function () {
it("fails", function () {
new Foo().boo()
})
it("throws", function () {
throw new Error("Error on Line 16")
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment