Articles
Why do I need a custom ESLint config? A natural tendency after coding for a while is gravitating towards specific habits and conventions. If you participate in collaborative projects, there is a high chance that a specific style is enforced via code reviews or automated checks. Either implicitly or explicitly, you most probably already adhere to a style guide. There are two main aspects of a style…
Replacing dependencies with test doubles (stubs, spies etc.) is fundamental in writing robust unit tests. At the same time, it may feel a bit complicated in practice, with similar cases requiring different approaches. In this article, we will demonstrate using Sinon.js to replace dependencies with test doubles in real-life scenarios ("recipes"). Enjoy! 👩🍳 🔗 Check out our Test doubles in…
Dependencies are an integral part of most codebases. They come in different forms: internal dependencies : our own modules (functions and classes), used by other parts of our code external dependencies : modules exposed by libraries, frameworks etc physical dependencies : database, network connection etc In unit testing, we want to test modules (units) "in a vacuum" in order to quickly and…
Why test doubles? Dependencies are an integral part of most codebases. They come in different forms: internal dependencies: modules (functions and classes) used by the rest of the code external dependencies: modules exposed by libraries, frameworks etc physical dependencies: file system, database, network connection etc The goal of unit testing is testing modules (units) "in a vacuum" in order to…
Disclaimer: this is not an article for testing mocha coffee recipes. We are talking about Mocha.js , a popular JavaScript testing framework. Mocha is usually combined with Chai.js , an assertion library (damn, this article already feels like an actual recipe cookbook!) Together with Sinon.js , a mocking library, they can deal with a big portion of unit tests. In this article, we will go…
AWS Lambda is a flexible and cost effective service which allows you to implement back-end functionality in a serverless environment. In this tutorial we will learn how to invoke a Lambda function. There are mainly two way to do that: Manually (using a test event) Programmatically We will use JavaScript / Node.js in the code snippets, but their logic should be easily transferable to the rest of…
AWS Lambda is a flexible and cost effective service which allows you to implement back-end functionality in a serverless environment. In this tutorial we will create a script to automate the deployment of Lambda functions. Apart from an AWS account, we will also need The Lambda function name (ARN) and region. We can find the ARN by selecting our lambda function in the AWS Lambda service. The…