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

discussion starter: specify ts version #62

Closed
wants to merge 2 commits into from

Conversation

phryneas
Copy link

This is more a discussion starter than an actual PR right now - but it works.

I've been able to run the tests for all versions from 3.0 to 3.7 with this approach by installing the respective @testable-ts version and executing them like

TYPESCRIPT_PATH=@testable-ts/v3.7 yarn test

Do you think this approach has any merit?

@phryneas phryneas changed the title draft: specify ts version discussion starter: specify ts version Dec 25, 2019
@@ -0,0 +1,3 @@
import * as ts from "@testable-ts/v3.0";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be a 3.0 version of typescript because newer typescript versions make use of non-downward-compatible typescript features in their types.

So testing 3.0 with types of 3.7 does not work, while testing 3.7 with types from 3.0 works just fine - especially as these types are just being used to interpret the code of tsd itself (I am not sure but I believe outside of the test suite this would not play any role at all).

@@ -0,0 +1,2 @@
module.exports = require(process.env.TYPESCRIPT_PATH ||
__dirname + "/../shipped-typescript");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the magic happens: use the environment variable or fall back the shipped typescript version (current behaviour)

@phryneas
Copy link
Author

@SamVerschueren it's been a while, do you have any feedback on this?

@SamVerschueren
Copy link
Collaborator

Hi @phryneas! Sorry for my late replies but started to allocate more time for tsd.

I believe this is somewhat where I want to go to yes. I believe it would be nice if you could specify the TS versions you want to test in the tsd config.

{
    "tsd": {
        "typescript": ">=3.2"
    }
}

Not sure yet about the syntax. But running tsd on this project would spawn multiple processes, for each version one, with the environment variable set like you did here manually.

That would be super cool!

What do you think?

@phryneas
Copy link
Author

phryneas commented Jul 4, 2020

That would be pretty incredible although it might probably be necessary to skip some tests depending on TS version (no use running tests with as const in TS 3.1), so some way of specifying which files to run would be great.

@SamVerschueren
Copy link
Collaborator

Closing this as it's WIP currently. Feel free to discuss in the issue #47.

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

Successfully merging this pull request may close these issues.

2 participants