Skip to content

Commit 073b586

Browse files
Johann-Sbardiharborow
authored andcommitted
Add unit test
1 parent 8be35c6 commit 073b586

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

lib/__tests__/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const babel = require('babel-core')
2+
const plugin = require('../index.js')
3+
const options = {
4+
presets: [
5+
["es2015", {
6+
"modules": false
7+
}]
8+
],
9+
plugins: [plugin]
10+
}
11+
12+
it('Imports stripped', () => {
13+
var example = `
14+
import fs from 'fs'
15+
import path from 'path'
16+
`
17+
18+
const {code} = babel.transform(example, options)
19+
expect(code.length).toBe(0)
20+
})

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,13 @@
2020
"repository": {
2121
"type": "git",
2222
"url": "https://github.com/bardiharborow/babel-plugin-transform-es2015-modules-strip.git"
23+
},
24+
"scripts": {
25+
"test": "jest"
26+
},
27+
"devDependencies": {
28+
"babel-core": "^6.25.0",
29+
"babel-preset-es2015": "^6.24.1",
30+
"jest": "^20.0.4"
2331
}
2432
}

0 commit comments

Comments
 (0)