Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript support #731

Closed
vforv opened this issue Aug 3, 2017 · 10 comments
Assignees
Labels
Milestone

Comments

@vforv
Copy link

@vforv vforv commented Aug 3, 2017

It would be good if we can changed default runner... Instad node to use ts-node... Is that possible?

@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Aug 3, 2017

I don't want to make it the default. But we could possibly add ts-lab that uses ts-node...

@vforv

This comment has been minimized.

Copy link
Author

@vforv vforv commented Aug 3, 2017

That would be great. Currenly we need to compile typescript files, then to run lab and on the end to delete js files. And with lint command we don't access to ts files just to plain js...

Maybe also you can add it as a argument... Something like this lab --runner=ts-node, if that possible...

@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Aug 4, 2017

Another option is to use ts-node test/ to run your tests

@vforv

This comment has been minimized.

Copy link
Author

@vforv vforv commented Aug 6, 2017

I am able to perform test like this:
ts-node server.test.ts
But then I have problem with options from lab:
lab -a code -t 100 -L -v -T
I don't know how to add test coverage and linting?

One note:
I found this module: lab-transform-typescript
And I am able to use it something like this:
lab -a code -t 100 -L -v -T ./node_modules/lab-transform-typescript
But linting and test coverage not working as expected.

@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Aug 7, 2017

What issues do you run into with test coverage?

@vforv

This comment has been minimized.

Copy link
Author

@vforv vforv commented Aug 7, 2017

I cover with test some part of code but it still marked as not covered. For linting I add some dummy code like var test = "unused", but it is not detected after run test.

@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Aug 7, 2017

@vforv can you provide more details to help me reproduce, some example code and more details on your setup (versions)

@vforv

This comment has been minimized.

Copy link
Author

@vforv vforv commented Aug 8, 2017

@geek I created github repo hapi-seneca-ts... It is starter for seneca, hapi and typescript. Here is repo:
https://github.com/vforv/hapi-seneca-ts

Check readme file how to run it and run tests. Also if there is something that I can imporve or add pls open tickets, I am glad to hear new suggestions...

@geek

This comment has been minimized.

Copy link
Member

@geek geek commented Aug 10, 2017

@vforv I ran the tests in api-gateway and see 96% coverage, what lines are showing they are missing coverage but are actually covered?

@vforv

This comment has been minimized.

Copy link
Author

@vforv vforv commented Aug 10, 2017

plugins/routes/index.ts missing coverage on line(s): 22, 23, 24

It is plugin function:


private _register(server: HapiServer, options: any) {
        // Register
        return 'register';
}

But I think I cover it with this test(test/routePlugin.ts):


 L.test('Route plugin should work', (done) => {

        expect(plugin['_register']).to.be.a.function();
        expect((plugin as any)._register()).to.be.a.string();  //HERE
        done();
    });

Also lint not detect when I add some junk code...

@geek geek self-assigned this Aug 13, 2017
@geek geek added the feature label Aug 13, 2017
@geek geek added this to the 14.2.0 milestone Aug 13, 2017
@geek geek closed this in #734 Aug 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.