Skip to content

Commit f8f99c6

Browse files
authored
feat: allow include/exclude rules to be a string rather than array (#22)
1 parent 5205235 commit f8f99c6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Diff for: index.js

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ function TestExclude (opts) {
1414
configFound: false
1515
}, opts)
1616

17+
if (typeof this.include === 'string') this.include = [this.include]
18+
if (typeof this.exclude === 'string') this.exclude = [this.exclude]
19+
1720
if (!this.include && !this.exclude && this.configKey) {
1821
assign(this, this.pkgConf(this.configKey, this.configPath))
1922
}

Diff for: test/test-exclude.js

+10
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,14 @@ describe('testExclude', function () {
183183
})
184184
})
185185
})
186+
187+
// see: https://github.com/istanbuljs/babel-plugin-istanbul/issues/71
188+
it('allows exclude/include rule to be a string', function () {
189+
const e = exclude({
190+
exclude: 'src/**/*.spec.js',
191+
include: 'src/**'
192+
})
193+
e.shouldInstrument('src/batman/robin/foo.spec.js').should.equal(false)
194+
e.shouldInstrument('src/batman/robin/foo.js').should.equal(true)
195+
})
186196
})

0 commit comments

Comments
 (0)