Skip to content

Commit f3ae011

Browse files
committed
include mocha fixes to run babel+JSX
1 parent 7b64252 commit f3ae011

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"prod": "webpack -p",
3535
"dev": "webpack -d --devtool hidden --output-file=tota11y.js",
3636
"lint": "eslint index.js plugins test",
37-
"test": "mocha --compilers js:babel/register test/*.js",
37+
"test": "mocha --require test/babel-hook test/*.js",
3838
"live-test": "webpack-dev-server --hot --inline"
3939
},
4040
"license": "MIT"

test/babel-hook.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* A mocha hook that will run before each test.
3+
*
4+
* This sets up babel with options, and stores our JSX transpile target.
5+
*/
6+
7+
// Register all future "require"s with babel
8+
require("babel/register")({
9+
// Let babel know to transpile JSX into E(...)
10+
jsxPragma: "E",
11+
});
12+
13+
// Store our custom JSX transpile target as a global
14+
E = require("../element.js");

0 commit comments

Comments
 (0)