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... 2022.03.30 JavaScript/TypeScript
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... 2022.03.28 JavaScript/TypeScript
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... 2022.03.25 JavaScript/TypeScript
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 ... 2022.03.23 JavaScript/TypeScript
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 ... 2022.02.23 JavaScript/TypeScript
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... 2022.02.21 JavaScript/TypeScript
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... 2022.01.26 JavaScript/TypeScript
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... 2022.01.21 JavaScript/TypeScript
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. 2021.11.17 JavaScript/TypeScript
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 ... 2021.11.15 JavaScript/TypeScript