Telegram Web
๐ŸคŸ Node.js Testing Best Practices

A detailed guide to modern testing in Node from a group of developers who know all about it. Itโ€™s on GitHub but is essentially written like a free book covering over 50 battle-tested tips covering areas as diverse as the โ€˜Testing Diamondโ€™, testing microservices, checking contracts, verifying OpenAPI correctness, and simulating flaky network conditions.

Goldberg, Salomon, and Gluskin
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘9๐Ÿ”ฅ3โค2
CHALLENGE

function createCounter() {
let count = 0;

return function() {
count++;
return count;
};
}

const counter1 = createCounter();
const counter2 = createCounter();

counter1();
counter1();
counter2();

const result = counter1() + counter2();
console.log(result);
๐Ÿ‘8๐Ÿค”8โค4
What is the output?
Anonymous Quiz
25%
3 + 2
38%
5
29%
3
8%
4
๐Ÿค”10
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘6๐Ÿค”4โค2
CHALLENGE

// What will be logged when this code runs?
const counter = (() => {
let count = 0;

return {
increment() {
count += 1;
return this;
},
reset() {
count = 0;
return this;
},
get value() {
return count;
}
};
})();

const { increment, value } = counter;

increment();
counter.increment();

console.log(value);
๐Ÿคฃ11๐Ÿ‘7โค6๐Ÿค”3
What is the output?
Anonymous Quiz
25%
undefined
36%
2
23%
0
16%
1
๐Ÿ‘8๐Ÿค”8๐Ÿคฃ2
CHALLENGE

function processConfig(config) {
const defaultPort = 8080;
const defaultTimeout = 5000;

const port = config?.port ?? defaultPort;
const timeout = config?.timeout ?? defaultTimeout;
const debug = config?.debug ?? false;

return {
summary: `Port: ${port}, Timeout: ${timeout}, Debug: ${debug ? 'enabled' : 'disabled'}`,
isUsingDefaults: port === defaultPort && timeout === defaultTimeout
};
}

const result = processConfig({ port: 0, timeout: null });
console.log(result.summary);
๐Ÿค”4๐Ÿ‘3โค2๐Ÿ”ฅ1
๐Ÿค– Firebase Studio: Google's New Agentic AI-Powered Development Environment

Buzzing from the success of Gemini 2.5 Pro for dev tasks, Googleโ€™s Firebase team gets in on the AI development action with a Cursor/v0/Lovable-a-like of its own for building apps in the browser.

Google
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘8๐Ÿ”ฅ4โค1
CHALLENGE

function processUserData(data) {
const settings = {
theme: data.preferences?.theme ?? 'light',
notifications: data.preferences?.notifications ?? true,
fontSize: data.preferences?.fontSize ?? 16
};

let status = data.status ?? 'active';
let reputation = data.reputation ?? 0;

console.log(reputation || 'No reputation yet');
return settings;
}

processUserData({ status: '', reputation: 0 });
โค3๐Ÿ‘3๐Ÿค”1
What is the output?
Anonymous Quiz
27%
0
28%
undefined
40%
No reputation yet
5%
null
โค5๐Ÿ‘4๐Ÿค”3๐Ÿ”ฅ1
๐Ÿคฉ Comparing Tauri and Electron for Building Desktop Apps

Electron is a natural choice for building JS and HTML-powered cross-platform desktop apps but numerous alternatives have appeared like Neutralinojs and the Rust-based Tauri. This post does a good job of quickly showing how Tauri differs and why you might choose it.

Costa Alexoglou
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘4๐Ÿ”ฅ2โค1
CHALLENGE

type User = {
id: number;
name: string;
email?: string;
};

function processUser<T extends User>(user: T): T & { processed: boolean } {
return { ...user, processed: true };
}

const partialUser = { id: 1, name: 'Alice' };
const result = processUser(partialUser);

console.log(typeof result.email);
๐Ÿ‘8๐Ÿ”ฅ3โค1
โค4๐Ÿ‘2๐Ÿ”ฅ2๐Ÿคฉ1
๐Ÿ˜† Vibe coding Tax has become a real thing!

Cursor's new "pay as you go" strategy with better models drives 20-30% more code generation than you would typically do. For all of the "vibe coders" out there, this is becoming an exponential "coding tax" for products because more code equals more token consumption, which generates more code...

Tigran Bayburtsyan
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿคฃ17๐Ÿ‘4โค3๐Ÿค”1
CHALLENGE

const num1 = 9007199254740992n;
const num2 = 1n;

const result1 = num1 + num2;
const result2 = Number(num1) + Number(num2);
const result3 = num1 + BigInt(1);
const result4 = String(num1) + String(num2);

console.log(typeof result2 === typeof result1, result1 === result3, result4);
๐Ÿ‘2
๐Ÿ•ต๏ธ ๐—ช๐—ฒ ๐—ฐ๐—ฎ๐˜‚๐—ด๐—ต๐˜ ๐Ÿ‡ฐ๐Ÿ‡ต๐—Ÿ๐—ฎ๐˜‡๐—ฎ๐—ฟ๐˜‚๐˜€ ๐—›๐—ฎ๐—ฐ๐—ธ๐—ถ๐—ป๐—ด ๐—š๐—ฟ๐—ผ๐˜‚๐—ฝ ๐—ฑ๐—ฒ๐—ฏ๐˜‚๐—ด๐—ด๐—ถ๐—ป๐—ด ๐˜๐—ต๐—ฒ๐—ถ๐—ฟ ๐—ผ๐˜„๐—ป ๐—บ๐—ฎ๐—น๐˜„๐—ฎ๐—ฟ๐—ฒ... ๐—ถ๐—ป ๐—ฟ๐—ฒ๐—ฎ๐—น ๐˜๐—ถ๐—บ๐—ฒ.

A couple of weeks ago, something unexpected happened. While monitoring malicious uploads to the NPM ecosystem, we stumbled on a suspicious package: react-html2pdf.js (now suspended). At first glance, it looked innocuous. ๐—ก๐—ผ ๐—น๐—ถ๐—ณ๐—ฒ๐—ฐ๐˜†๐—ฐ๐—น๐—ฒ ๐—ต๐—ผ๐—ผ๐—ธ๐˜€. ๐—ก๐—ผ ๐—ผ๐—ฏ๐˜ƒ๐—ถ๐—ผ๐˜‚๐˜€ ๐—บ๐—ฎ๐—น๐˜„๐—ฎ๐—ฟ๐—ฒ. Just a basic function in the index.js file.

Mackenzie Jackson
๐Ÿค”6๐Ÿคฃ6โค2
CHALLENGE

function createSymbolDemo() {
const obj = {};

const sym1 = Symbol('description');
const sym2 = Symbol('description');
const sym3 = Symbol.for('shared');
const sym4 = Symbol.for('shared');

obj[sym1] = 'Value 1';
obj[sym2] = 'Value 2';
obj[sym3] = 'Value 3';
obj[sym4] = 'Value 4';

console.log(Object.keys(obj).length, sym1 === sym2, sym3 === sym4, obj[sym3]);
}

createSymbolDemo();
๐Ÿ‘6
๐Ÿค”9๐Ÿ‘3โค2
2025/07/13 12:17:57
Back to Top
HTML Embed Code: