Open ghost opened 8 years ago
That statement is a generic catch-all for unexpected things seen in the AST. The bug was fixed for the specific case that was reproduced there.
Unless you can provide a minimal reproducible test case, I have no idea how to debug this. Is there any way you could provide a simple test case that fails?
I had the same issue. For example for this it works fine:
// src/111.js
class A {
helloWorld () {
console.log('Hello world!')
}
}
export {A}
// test/111.test.js
import {A} from '../src/111.js'
it('Test', () => {
new A().helloWorld()
})
But if I add export const STATE = 'open'
to 111.js
export const STATE = 'open'
class A {
helloWorld () {
console.log('Hello world!')
}
}
export {A}
It throws this exception. And if I export the STATE
constant like this
const STATE = 'open'
class A {
helloWorld () {
console.log('Hello world!')
}
}
export {STATE, A}
it works fine again.
@gotwarlost This issue can be solved if you accept the PR that have been pending for months - https://github.com/gotwarlost/istanbul/pull/507. It's related to this issue.
It would be helpful if the error message said where in the code it sees something unexpected. Then at least I could share the particular bit of code that triggered it.
I looks like I can avoid the error by downgrading to mocha 3.5. Any newer version seems to be incompatible with istanbul 0.4.5.
I know this is a very very old bug, and supposed to be fixed in Istanbul 0.2.9. But it still exist, and isn't fixed. If you are running a combo of Rollup+Buble+Rollup-plugin-istanbul it will happend to you. Even if I replace Buble with Babel it will still happen inside the Karma test runner.
IF I comment out Istanbul, everything works just fine.
Ref: https://github.com/gotwarlost/istanbul/issues/202