#ava #Testing #node #javascriptAVA: pass or fail a test if an environment variable is missing/emptyIn a recent project I needed to fail/pass some AVA if a runtime environment variable was unset or empty. Here’s how I solved this issue. AVA is a test runner for Node.js with a concise API, detailed error output, embrace of new language features and process isolation that l ...
#node #ava #Testing #javascriptJavaScript Object.defineProperty for a function: create mock object instances in Jest or AVAThis post goes through how to use Object.defineProperty to mock how constructors create methods, ie. non-enumerable properties that are functions. The gist of Object.defineProperty use with a function value boils down to: const obj = {} Object.defineProperty(obj, 'yes', { ...