3 ms·
Can you describe an example of a better, real-world unit test you have in mind? Do you also advocate against writing ES6 and using Babel?
by nteon 11y ago
Can you describe an example of a better, real-world unit test you have in mind?
Do you also advocate against writing ES6 and using Babel?
- BinaryIdiot 11y ago> Can you describe an example of a better, real-world unit test you have in mind? Considering the output is a JavaScript library people will be using it in that context more than with TypeScript and many of the others. So I don't have a specific real-world unit test example but in general your unit tests have to test the various ways people are going to use your API from the target language. So you'll need to make sure it behaves in the expected ways with valid and invalid input. At the very least I'd expect unit tests to be written in JavaScript to hit a TypeScript library to help eliminate any weirdness that could have been missed. > Do you also advocate against writing ES6 and using Babel? Yup. ECMAScript 6 is great but the support is still not entirely there (especially in older browsers) and many of the transpilings are not quite equivalent. Granted Babel is pretty high quality (minus their whole decided not to ship any transpilers in the default package anymore) and I would expect it to be close enough. But after being bit by CoffeeScript so many years ago I'd rather not deal with transpilers and use the real thing when I can. Coding in ECMAScript 5 is guaranteed compatible with ECMAScript 6, most web browsers and most versions of node. So I look at it like this: why add the extra complexity just for a few extra, nice, syntax improvements?