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
๐ค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
๐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
What is the output?
Anonymous Quiz
29%
Port: 8080, Timeout: 5000, Debug: disabled
27%
Port: 0, Timeout: null, Debug: disabled
38%
Port: 0, Timeout: 5000, Debug: disabled
7%
Port: undefined, Timeout: null, Debug: disabled
โค4๐3๐ค3
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.
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
โค5๐4๐ค3๐ฅ1
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
What is the output?
Anonymous Quiz
19%
object
27%
string
27%
Error: Property 'email' does not exist on type 'User'
27%
undefined
โค4๐2๐ฅ2๐คฉ1
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
What is the output?
Anonymous Quiz
28%
false false "90071992547409921"
30%
true true "90071992547409921"
27%
false true 9007199254740993n
15%
false true "90071992547409921"
๐6โค4๐ฅ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
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
What is the output?
Anonymous Quiz
22%
0 false true Value 4
32%
4 true true Value 4
34%
4 false false Value 3
12%
0 false true Value 3
๐ค9๐3โค2