Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Support for typescript and mocha #31

Closed
heatherlp opened this issue Nov 16, 2018 · 2 comments
Closed

Support for typescript and mocha #31

heatherlp opened this issue Nov 16, 2018 · 2 comments

Comments

@heatherlp
Copy link

heatherlp commented Nov 16, 2018

I've recently made this extension a dependency of the IBM Blockchain extension (https://github.com/IBM-Blockchain/blockchain-vscode-extension) so first of all, thank you! This extension is a really useful tool for us to allow developers to run smart contract tests.

I find it doesn't work for typescript tests however, I see this:

import * as assert from 'assert';
^^^^^^
SyntaxError: Unexpected token import

I've played round with the mocha command that is run by the extension and I've found that I can get it working if I use the following:
node_modules/.bin/_mocha -r ts-node/register <test_file>

  • Aside from adding in a compile/watch step somewhere before the tests are being run, does anyone have any other solutions to this problem?
@heatherlp
Copy link
Author

Ok, worked around this by making use of: "javascript-test-runner.additionalArgs": "-r ts-node/register" as it doesn't matter where the ts-node/register bit belongs in the command. Now the extension runs:

node_modules/.bin/_mocha <test_file> -r ts-node/register

I think it would be good to get this fixed in the extension so that this command is run when typescript tests are detected? As an alternative to compiling the typescript.

@g3offrey
Copy link
Owner

Hello,

Please accept my apologies for the late answer.
I published a status about this extension. 😞
(TL;DR: I won't be able to work on it anymore)

#41 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants