Skip to content

Commit

Permalink
Merge pull request #22 from power-assert-js/babel6
Browse files Browse the repository at this point in the history
Breaking Change: update to Babel 6 & babel-plugin-espower 2.0
  • Loading branch information
azu committed Nov 13, 2015
2 parents 2ac56cd + be81600 commit ccf15ce
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"stage": 0
"presets": ["es2015", "stage-3"],
"plugins": ["transform-es2015-modules-commonjs"]
}
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ See the power-assert output appears!

## HOW TO USE

### Zero-config mode
### Zero-config mode(for testing)

If your tests are located on `'test/**/*.js'`, just run mocha with `--compilers js:espower-babel/guess`

Expand Down Expand Up @@ -161,20 +161,30 @@ Babel has many transform options.

`espower-babel` read `${cwd}/.babelrc` if exists.

also can manually configure babel transform options.
Also, you can manually configure babel transform options.

e.g.)

```js
require('espower-babel')({
babelrc: {
stage: 0
"presets": ["es2015"],
"plugins": ["transform-es2015-modules-commonjs"]
}
})
```

**Caution**:

Babel 6 does not transform your code by default.
It means that you must set babel config by `.babelrc` file or `babelrc` option.

### Transform all files with Babel **by default**

Do limit transform files by setting `babelrc`

e.g.)

```js
require('espower-babel')({
babelrc: {
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,19 @@
"url": "https://github.com/power-assert-js/espower-babel/issues"
},
"dependencies": {
"babel-core": "^5.0",
"babel-plugin-espower": "^1.0.0",
"minimatch": "^2.0.1",
"source-map-support": "^0.2.10",
"babel-core": "^6.0.0",
"babel-plugin-espower": "^2.0.0",
"minimatch": "^3.0.0",
"source-map-support": "^0.3.3",
"xtend": "^4.0.0"
},
"devDependencies": {
"babel-plugin-transform-es2015-modules-commonjs": "^6.1.18",
"babel-polyfill": "^6.1.19",
"babel-preset-es2015": "^6.1.18",
"babel-preset-stage-3": "^6.1.18",
"expect.js": "^0.3.1",
"mocha": "^2.1.0",
"power-assert": "^0.11.0"
"power-assert": "^1.1.0"
}
}
5 changes: 2 additions & 3 deletions test/tobe_instrumented/es7_test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
require("babel-core/polyfill")
require("babel-polyfill")

let assert = require('power-assert')

describe("ES7 async/await", ()=>{
it("works", async()=>{
let ok = await Promise.resolve("OK")

assert(`${ok}` === "OK")
assert(await Promise.resolve("OK") === "OK")
})
})
3 changes: 2 additions & 1 deletion test_loader/espower-traceur-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require('..')({
]
},
babelrc: {
stage: 0
"presets": ["es2015", "stage-3"],
"plugins": ["transform-es2015-modules-commonjs"]
}
});

0 comments on commit ccf15ce

Please sign in to comment.