Skip to content

How to pass babel transpiling to mocha? #81

Description

@christian-schwaderer

I have a mixed JavaScript/TypeScript project. For running, the JavaScript files are getting transpiled via babel-node.

Now, I'm trying to set-up ts-mocha for running tests. However, I keep getting

src/index.js:3

import 'whatever';

^^^^^^

SyntaxError: Cannot use import statement outside a module

I guess, I would need to pass something like --compilers js:@babel/register to mocha. But how do I do that when using ts-mocha?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions