Skip to content

Commit 0589591

Browse files
committedNov 16, 2021
make import-jsx work in makeReporter
1 parent aef65e0 commit 0589591

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎bin/run.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,10 @@ const globFiles = files => Array.from(files.reduce((acc, f) =>
435435
return set
436436
}, new Set()))
437437

438-
const makeReporter = exports.makeReporter = (tap, options) => {
438+
// caller-callsite requires that the call stack includes at least one
439+
// spot where "this" is defined, so we bind this function to an object
440+
// in this completely weird way, or else import-jsx doesn't work.
441+
const makeReporter = exports.makeReporter = function (tap, options) {
439442
const treportTypes = require('treport/types')
440443
const tapMochaReporter = require('tap-mocha-reporter')
441444
// if it's a treport type, use that
@@ -472,7 +475,7 @@ const makeReporter = exports.makeReporter = (tap, options) => {
472475
`Invalid reporter: not a stream or react component ${reporter}`)
473476
}
474477
}
475-
}
478+
}.bind({})
476479

477480
const stdinOnly = options => {
478481
// if we didn't specify any files, then just passthrough

0 commit comments

Comments
 (0)
Please sign in to comment.