Skip to content

Slow testing #184

@xogeny

Description

@xogeny

I'm seeing an issue with mocha, ts-node and typescript. My current versions are 3.0.2, 1.3.0 and 2.0.0, respectively. However, I've been having this issue for a while with older versions of these tools, so this isn't new to, for example, typescript@2.0.0 or mocha@3.0.2.

To see the issue, consider the following three commands:

$ time tsc                                                                                                                                     

real    0m4.380s
$ time mocha lib/test/ConsistencyTests.js                                                                                                      
...                                                                                                                                     
real    0m3.487s  

So far, so good. But this shows the real issue:

$ time mocha test/ConsistencyTests.ts       
...
real    1m22.379s         

In summary, it takes over 10x longer to run mocha and have ts-node do the compilation behind the scenes than to run tsc and then mocha on the emitted code. Am I missing something here?

My mocha.opts file is pretty standard, I think:

--compilers ts:ts-node/register
--harmony
--harmony_destructuring
--harmony-proxies

Note, it doesn't seem like the "harmony" stuff is (entirely?) to blame. If I remove those flags, it takes over 28 seconds before I even get an error back related to destructuring syntax. So something is going on during that time that is way out of proportion with the normal time it takes to compile the code

I should add that this is on Windows (related to #163 or #137 ?).

Any suggestions? Anything I can do to further diagnose the problem. This is my customer's proprietary code, so no chance to share a reproducible case I'm afraid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions