Skip to content

Provide instructions and more examples for setting up Jasmine with Typescript. #175

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

Open
Kered13 opened this issue Feb 8, 2025 · 1 comment

Comments

@Kered13
Copy link

Kered13 commented Feb 8, 2025

The FAQ here mentions a few approaches for using Jasmine with TypeScript, however it provides no instructions and only a single example (for a React app, a very narrow example) on how to actually perform this. This is particularly egregious given comments like "The compile-on-the-fly approach is usually easy to set up".

@sgravrock
Copy link
Member

This has gotten a lot harder in the days since the existing documentation was written. It used to be that there were basically three common ways to compile TypeScript: to disk with tsc, to disk with babel, or on the fly with babel, and users generally knew which one of those they were using. (The major exceptions were frameworks like Angular that came with their own pre-configured testing tools.) The FAQ and examples were written with that world in mind. Nowadays, the TypeScript ecosystem is much more fragmented. It really doesn't make sense to talk about a standard dialect of TypeScript or a standard toolchain any more. All there is is a set of "very narrow examples", each of which is used by a group of people who tend to think their setup is standard TypeScript. And the knowledge of how to compile each dialect is much more likely to be hidden inside framework-specific toolchains where users can't easily see it. For instance, how many Vite users are even aware that tsc can't generate working JS from their TypeScript, or know what to use instead?

All of which is to say: I see the problem, but I'm not sure how to solve it with documentation. Trying to provide a comprehensive set of examples or documentation for every dialect of TypeScript would be a fool's errand. Keeping that documentation up to date would also be a fool's errand.

Another option would be to make the documentation more general: "Assuming that you already know how to compile your particular TypeScript code into running JavaScript, here's how you hook that into Jasmine." But that would be more work for users, since they'd need to figure out the specific steps for their TypeScript dialetct. And it would be no help to all to users who don't know how to compile their own code and don't have an easy path to learning how.

I'm open to suggestions, but I'm not sure how much Jasmine can (or should) do to compensate for the coordination failures of the TypeScript ecosystem.

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

No branches or pull requests

2 participants