Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

4330 bites

Page 94

What is Angular's TestBed and when would you use it?
Vue, Angular & Svelte2 min read

What is Angular's TestBed and when would you use it?

Say createComponent returns a fixture with no immediate binding, so await fixture.whenStable before asserting DOM.

Vue, Angular & Svelte2 min read

How do you test emitted events using Vue Test Utils?

Tests Vue Test Utils event inspection. Strong answer: mount, trigger('click'), then check wrapper.emitted('increment') for the payload array. Remember it returns an array of arrays, one per emission.

How do you mock an async service call in an Angular component test?
Vue, Angular & Svelte2 min read

How do you mock an async service call in an Angular component test?

This tests Angular unit isolation and HTTP mocking. A strong answer covers HttpTestingController setup, flushing a mock response, asserting UI changes, and notes mocking avoids flaky networks. Red flag: using real HTTP calls in unit tests.

Vue, Angular & Svelte2 min read

How do you test a Svelte component updates a writable store?

Import the store with the component, render, await fireEvent.click, then assert the store value.

Describe the role of a spy in testing with a framework example
Vue, Angular & Svelte2 min read

Describe the role of a spy in testing with a framework example

This tests whether you know a spy records calls without replacing original implementation. A strong answer defines the tracking role, picks a concrete Vue or Angular handler, and asserts with toHaveBeenCalled.

How would you diagnose and optimize slow Angular component tests?
Vue, Angular & Svelte2 min read

How would you diagnose and optimize slow Angular component tests?

Tests Angular test economics and runner overhead. Strong answers profile with Vitest, swap Karma for jsdom/happy-dom, mock services, and reduce TestBed recompilation via targeted imports.

Vue, Angular & Svelte2 min read

Testing shared Vue components: unit, a11y, visuals?

Unit tests (Vitest/Jest) for logic, accessibility tests (axe, Pa11y) for ARIA/keyboard, visual regression (Percy, Chromatic) for rendering.

Vue, Angular & Svelte2 min read

What is the Virtual DOM's role during a Vue state update?

Tests your grasp of Vue's reactive render pipeline. A strong answer: state change triggers a new virtual DOM tree; runtime diffs it against the old tree to apply only necessary real DOM updates. Red flag: saying virtual DOM updates browser DOM directly.

Why is Svelte called a 'disappearing framework'?
Vue, Angular & Svelte2 min read

Why is Svelte called a 'disappearing framework'?

Tests whether you understand compile-time versus runtime-heavy frameworks. A strong answer says Svelte compiles components to vanilla JS at build time, shipping a tiny runtime instead of a reconciler or virtual DOM. Red flag: claiming there is zero runtime.

Vue, Angular & Svelte2 min read

How is a Vue template compiled into a render function?

Map v-if to ternaries, v-for to array map, and events to onXxx props.

Vue, Angular & Svelte2 min read

Compare Angular Zone.js and Vue 3 Proxy reactivity

This tests update granularity. Contrast Vue 3 Proxy tracking, targeting only affected components, with Angular Zone.js patching async APIs to trigger top-down dirty checking across tree. Vue binds deps at render; Angular compares values each cycle.

How does Svelte compile count += 1 into DOM updates?
Vue, Angular & Svelte2 min read

How does Svelte compile count += 1 into DOM updates?

Tests if you know Svelte reactivity is compile-time via runes, not runtime proxies. Good answer: $state marks reactive vars; runes are compiler hooks; compiler emits DOM-sync code. Red flag: describing useState or VDOM.

Vue, Angular & Svelte2 min read

Explain patch flags and static hoisting in Vue 3's compiler

Tests your grasp of compiler-informed virtual DOM optimizations. A strong answer covers patch flags as bitmap hints for dynamic bindings and static hoisting as extracting static nodes to skip diffing. Red flag: claiming Vue 3 removes the virtual DOM.

Vue, Angular & Svelte2 min read

What is SSR and what are its advantages over a client-side SPA?

This tests server-client rendering trade-offs. A strong answer defines SSR as server HTML generation plus client hydration, citing faster time-to-content, better SEO for async data, and unified component logic.

What is the purpose of +page.server.js in SvelteKit?
Vue, Angular & Svelte2 min read

What is the purpose of +page.server.js in SvelteKit?

Exclusively server-side load feeding the data prop, used for secrets like DB queries and private env vars.

Vue, Angular & Svelte2 min read

Hydration: SSR HTML to interactive app?

Server renders HTML, client JavaScript bootstraps and attaches event listeners (hydration), mismatch occurs if server HTML differs from client render.

How do you create a POST API endpoint in SvelteKit?
Vue, Angular & Svelte2 min read

How do you create a POST API endpoint in SvelteKit?

Add a +server.js file in a src/routes subdirectory, export a POST handler returning a Response, and note that +server files never run in the browser.

Explain server.ts and main.ts in Angular Universal
Vue, Angular & Svelte2 min read

Explain server.ts and main.ts in Angular Universal

Server.ts SSRs initial HTML via Node/Express; main.ts bootstraps the browser app and hydrates the DOM. First request hits the server; later navigations are client-side only.

Compare SSR, SSG, and ISR trade-offs in meta-frameworks
Vue, Angular & Svelte2 min read

Compare SSR, SSG, and ISR trade-offs in meta-frameworks

What it tests: matching rendering modes to build time, freshness, and scale. Outline: contrast SSR per-request cost with SSG fast CDN delivery but stale content and long builds, then show ISR as lazy regeneration post-deploy.

How does Angular's Zone.js change detection differ from Vue and Svelte reactivity?
Vue, Angular & Svelte2 min read

How does Angular's Zone.js change detection differ from Vue and Svelte reactivity?

Tests granular reactivity architecture. Angular Zone.js monkey-patches async to scan the full component tree; Vue uses runtime Proxy tracking; Svelte compiles runes into targeted DOM bindings.