Have you ever encountered random test instability on Continuous Integration? Called some test were just “flaky”? Tests that took 10s instead 10ms? I guess you did! There might be lots of reasons for flakiness of tests. I found asynchronous operations are great contributor to flakiness score.
Here I want to describe mocking async as simple alternative to done()
that could avoid many potential build failures.
I’m going to use Observable
to simulate asynchronous operations. It is not limited to RxJs though. The article applies to any kind of asynchronous operations under the hood of components and services.
To access variables…
One of the biggest flaw of built-in Angular translation engine is it only supports translations known during build time. Moreover, only known in HTML template.
One common struggle is translating calculated values like enums in TypeScript.
Good news for you: It’s quite easy if you follow one practice.
To make things easy to reason about, let’s have a Todo App :)
With usage:
So what is the problem?
{{ items.state }}
will produce generated enums values (0, 1, 2... or 'TODO', 'IN_PROGRESS'...)TL;DR; Source code of experiment. Solution.
In this article, we’re going to experiment with TypeScript 2.8 conditional and mapping types. The goal is to create a type that would filter out all keys from your interface, that aren’t matching condition.
You don’t have to know details of what mapping types are. It’s enough to know that TypeScript allows you to take an existing type and slightly modify it to make a new type. This is part of its Turing Completeness.
You can think of type as function — it takes another type as input, makes some calculations and produces new…
TL;DR; No new framework announced, go home kiddo… Oh Wait Nope! Progressive Web Apps happens to be the new hotness.
Christian Heilmann (video, slides, twitter)
Progressive Web Apps (PWA) — simply — are just websites built to be more like native apps. It’s not a new concept, but so far we were failing. Lack of native capabilities forced workarounds. Hardware and JS engines were not as fast as today. Everyone had to figure out their own definition of “Web App”.
Consider PWA as a set of principles to follow during building an app. …
JavaScript performance-solver at @Dynatrace. JavaScript trouble-maker on my own