Created
June 27, 2016 06:20
-
-
Save boneskull/eef8c05c4227a5829a3fa2ab9cdbebc4 to your computer and use it in GitHub Desktop.
canonical example of babel (es2015) and Mocha with source map support
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
export default function foo (str = 'bar') { | |
if (str === 'baz') { | |
throw new Error('baz is not allowed'); | |
} | |
return str; | |
} |
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
import foo from '.'; | |
import {ok} from 'assert'; | |
describe('foo()', () => { | |
it('should return "baz" (which should fail)', () => { | |
ok(foo() === 'baz'); | |
}); | |
it('should print a valid stack trace', () => { | |
foo('baz'); | |
}); | |
}); |
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": "mocha-sourcemaps", | |
"version": "0.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "mocha --require source-map-support --require babel-register index.spec.js" | |
}, | |
"keywords": [], | |
"author": "Christopher Hiller <[email protected]> (https://boneskull.com/)", | |
"license": "ISC", | |
"dependencies": { | |
"babel-preset-es2015": "^6.9.0", | |
"babel-register": "^6.9.0", | |
"mocha": "^2.5.3", | |
"source-map-support": "^0.4.0" | |
}, | |
"babel": { | |
"presets": [ | |
"es2015" | |
] | |
} | |
} |
@boneskull Thanks for the example. Here is what I get when using markdown reporter with a passing test: https://gist.github.com/thomas88/6cae8efc5795bd6e60f469d9bf84b692.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: