JavaScript/TypeScript

Sponsored links
JavaScript/TypeScript

How to mock fs.readdir and fs.readFile for unit testing

Reading a directory to get a file list and then, loading the file one by one. You might have seen such a function. If it...
JavaScript/TypeScript

How to inject user input data for unit tests

Some console applications require user inputs. For those inputs, we need to write unit tests. If we using readline modul...
JavaScript/TypeScript

error C2039 ‘Buffer’ is not a member of ‘node’

When I ran a build for C++ code by node-gyp, the following error occurred.$ npm run build> module-name@2.9.14 build D:\d...
JavaScript/TypeScript

How to start Unit Testing in TypeScript with mocha and chai

Writing unit tests is an important step to be an intermediate developer from a beginner. The developers who can't write ...
JavaScript/TypeScript

Chai Compare object array

I needed to write tests for object array but I spent time on how to write it. I write down how to do it to save my time ...
JavaScript/TypeScript

NPM How to pin dependency version of a dependency

If you are looking for a solution to pin a dependency of a dependency, you can use npm-force-resolutions.Let's see the u...
JavaScript/TypeScript

TypeScript Replace switch-case logic with Record object

Switch-case is one of the basics for conditional statements and it is supported by many programming languages. It is use...
JavaScript/TypeScript

Mocha nested before after function call order

I use mocha for writing unit tests. My test sometimes fails because of misunderstanding the order of nested before, befo...
JavaScript/TypeScript

TypeScript Pick nested object

Pick type is useful to get types from an existing definition. But is it possible to get a type from a nested object Yes! It's possible to get a type by using brackets with the key.
JavaScript/TypeScript

TypeScript/JavaScript Bitwise Operations

Bit operation is not often used in JavaScript/TypeScript but there are some cases where we need to use it. I needed the ...
Sponsored links