Created
July 11, 2014 01:57
-
-
Save ampedandwired/ffee80734382123a3b14 to your computer and use it in GitHub Desktop.
Webpack mocha loader runs multiple times
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expect = require('chai').expect; | |
describe('arithmetic', function() { | |
it("adds numbers", function() { | |
expect(1 + 1).to.eql(2); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "mochatest", | |
"version": "1.0.0", | |
"devDependencies": { | |
"chai": "^1", | |
"mocha": "^1", | |
"mocha-loader": "^0.6", | |
"script-loader": "^0.5", | |
"webpack": "^1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expect = require('chai').expect; | |
describe('strings', function() { | |
it("concatenates", function() { | |
expect("foo" + "bar").to.eql("foobar"); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv='Content-type' content='text/html; charset=utf-8'> | |
<title>Mocha Tests</title> | |
</head> | |
<body> | |
<script src="test_bundle.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
entry: ["mocha!./NumberSpec.js", "mocha!./StringSpec.js"], | |
output: { | |
filename: 'test_bundle.js' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run "webpack" and open test.html in a browser. Tests are run twice.