Last active
September 14, 2017 14:34
-
-
Save yamadayuki/c5ffc2b9af5da6851230 to your computer and use it in GitHub Desktop.
Babel6でMochaとChaiを使ったテストを書く ref: http://qiita.com/yamadayuki/items/9885c9e126648cd8c5e3
This file contains hidden or 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
Show hidden characters
{ | |
"presets": ["es2015"] | |
} |
This file contains hidden or 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
. | |
├── .babelrc | |
├── .eslintrc | |
├── package.json | |
└── test | |
├── setup.js | |
└── test.spec.js |
This file contains hidden or 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
test | |
✓ 1 + 2 = 3 | |
1 passing (12ms) |
This file contains hidden or 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
{ | |
... | |
"scripts": { | |
"test": "NODE_ENV=test mocha --compilers js:babel-register --recursive $(find test -name '*.spec.js')", | |
... | |
}, | |
... | |
} |
This file contains hidden or 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 { expect } from 'chai'; | |
describe('test', () => { | |
it('1 + 2 = 3', () => { | |
expect(1 + 2).to.equal(3); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment