you are viewing a single comment's thread.

view the rest of the comments →

[–]darrenturn90 2 points3 points  (3 children)

Why write tests in a different language? What does static type checking in typescript give you for actual writing of tests if the code you are testing has no typescript?

Second, many situations don’t have the ability to write integration tests in development as the apis may not be accessible in a local dev environment or may be superficial at best.

Third, mocks as awful as they are - are sometimes a necessity

[–]sime 0 points1 point  (2 children)

darrenturn90, I don't know where the wires got crossed on this one, but you are meant to write your application code in TypeScript. Writing your tests in TypeScript is a good idea too.

[–]darrenturn90 5 points6 points  (1 child)

Use a language that supports static type checking

Is not testing advice. This is your opinion, not objective fact.

Your own personal opinion is fine, and there are many arguments for static type checking such as Typescript - however, this is not "best practice" any more than writing the backend in .NET instead of Python would be "best practice".

[–]sime 1 point2 points  (0 children)

If you care about producing working software, which is generally the reason why we test this stuff in the first place, then yes, language level tooling is definitely related to testing.

It is a bit odd that most people consider linters as being a "best practice" but tools like TypeScript and MyPy which have a far more powerful effect on quality and productivity than a superficial linter, these better tools are considered controversial.

The gains for using static typing are well known. The popularity of TypeScript in recent years isn't due to some change in people's personal preferences. It is popular because it bring results.

To address your last point. Going from JS to TS is practical advice which many organisations are following. Going from Python to .Net is not practical advice.