Skip to content

Commit

Permalink
chore: Add regression test for #201
Browse files Browse the repository at this point in the history
Fixes #201
  • Loading branch information
coreyfarrell committed Apr 23, 2019
1 parent cf748dc commit 3050bbb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fixtures/issue-201.js
@@ -0,0 +1,9 @@
import { resolve } from 'path'

function test () {
const _path = 'path'

return resolve(_path)
}

test()
14 changes: 14 additions & 0 deletions test/babel-plugin-istanbul.js
Expand Up @@ -149,6 +149,20 @@ describe('babel-plugin-istanbul', function () {
result.code.match(/statementMap/)
})

// regression test for https://github.com/istanbuljs/babel-plugin-istanbul/issues/201
it('should not conflict with transform-modules-commonjs', function () {
var result = babel.transformFileSync('./fixtures/issue-201.js', {
plugins: [
[makeVisitor({ types: babel.types }), {
include: ['fixtures/issue-201.js']
}],
'@babel/plugin-transform-modules-commonjs'
]
})
result.code.should.match(/_path.*\.resolve\)\(_path\)/)
result.code.should.not.match(/_path\.resolve\)\(_path\)/)
})

it('should respect a changed cwd in options', function () {
const opts = {
cwd: path.resolve(__dirname, '..', 'lib')
Expand Down

0 comments on commit 3050bbb

Please sign in to comment.