When VS Code Testing Actually Works (And When It Doesn't)

Look, I've wasted so many weekends on tests that mysteriously fail in VS Code but work fine from the command line. Or tests that pass in my IDE but explode the moment they hit CI. If you've been there, this guide is for you.

The built-in Test Explorer works great when it works. Which is maybe 70% of the time on a good day? Your mileage may vary depending on what extensions you have installed and whether VS Code feels like cooperating.

The Test Explorer: When It Doesn't Hate You

Test Explorer is supposed to automatically find your tests. Sometimes it does, sometimes it just stares at you blankly while you mash the reload button like an idiot.

VS Code Test Explorer

Test Discovery Bullshit I've Dealt With:

  • Tests not showing up because of missing jest.config.js - even though npm test works fine
  • Test Explorer finds tests but throws "No tests found" when you try to run them
  • Tests randomly vanish and reappear when you edit files
  • Jest extension conflicting with ESLint extension, breaking everything until you disable one
  • VS Code 1.85 broke test discovery for a week until they patched it

When Test Explorer Actually Works:

When it works, the real-time feedback is pretty sweet. Change something, instantly see what breaks. Beats constantly alt-tabbing to check if you fucked up.

Breakpoint Debugging Reality Check:

Setting breakpoints in tests is hit or miss. Sometimes they work perfectly, sometimes they don't trigger at all. I'm probably biased because I've had more luck with `debugger;` statements, but that might just be my setup.

Jest: The Devil You Know

Jest Testing Framework Logo

Jest is everywhere, which means everyone's debugging the same stupid Jest issues. The good news is there are Stack Overflow answers for most of them.

Jest Extension Reality:

The Jest extension works great until it doesn't. Common issues I've hit:

My Jest VS Code Setup:

{
  "jest.jestCommandLine": "npm run test",
  "jest.autoRun": {
    "watch": false,  // I manually trigger tests, auto-run is annoying
    "onStartup": []   // Don't run tests on startup, it slows down VS Code
  },
  "jest.showCoverageOnLoad": false,  // Coverage UI kills performance
  "jest.debugMode": true
}

The Nuclear Option for Jest Issues:

  1. Reload the window (Cmd+Shift+P → "Developer: Reload Window")
  2. Still broken? Close VS Code, nuke node_modules, reinstall everything
  3. Still broken? Restart your computer and contemplate switching careers
  4. Still broken? Check Jest issues to see if you're not alone in your suffering

Vitest: Jest But Faster (When It Works)

Vitest Testing Framework

Vitest is basically Jest with better performance and less bullshit. The VS Code integration is pretty good, but it's newer so there are fewer Stack Overflow answers when things break.

What Might Work Better Than Jest (YMMV):

  • Test execution seems faster on larger codebases, but I haven't benchmarked it properly
  • TypeScript support is cleaner out of the box, though your config might be different
  • Hot module replacement for tests works when it works - sometimes it gets confused
  • Uses less memory in my experience, but could depend on your test setup

What Still Sucks:

  • Fewer extensions and tooling compared to Jest ecosystem
  • Some Jest plugins don't work with Vitest (obviously)
  • Documentation assumes you know Vite, which is annoying if you don't

Vitest VS Code Issues I've Hit:

  • Test discovery breaks if your `vite.config.js` is misconfigured
  • Watch mode occasionally gets stuck and stops running tests
  • Debugging breakpoints work better than Jest, but still not 100% reliable
  • Check Vitest GitHub discussions when things go wrong

Playwright: Browser Testing That Actually Works

Playwright Testing Framework

Playwright is probably the least frustrating way to do browser testing in VS Code. The Microsoft extension is solid, and debugging actually works most of the time.

What's Actually Good:

  • Test recording is legitimately useful - click around your app and get working test code
  • Debugging shows you both the browser state and VS Code debugger
  • Cross-browser testing doesn't require separate configurations
  • Error messages are usually helpful (unlike Selenium)

The Inevitable Pain Points:

  • Tests are slow as hell (it's launching actual browsers)
  • Flaky tests due to timing issues, especially with CSS animations
  • Memory usage gets insane when running multiple browser instances
  • VS Code crashes if you run too many Playwright tests at once
  • Check Playwright troubleshooting docs when tests randomly fail

Real Debugging War Story:

Spent forever on this weird Playwright issue. Test passed locally but kept timing out in CI. Think it was some timing thing with animations? Anyway, adding a wait fixed it but I'm still not 100% sure why. Probably should've dug deeper but deadlines, you know?

Playwright Debugging That Actually Helps:

test('login with actual debugging', async ({ page }) => {
  await page.goto('/login');
  
  // This actually pauses and lets you inspect manually
  await page.pause();
  
  // When debugging, keep the browser open
  await page.fill('[data-testid="email"]', 'test@example.com');
  // Breakpoint here lets you see both VS Code vars and browser state
  await page.click('[data-testid="submit"]');
});

The Weekend Debugging Survival Guide

Flaky Tests Are the Worst:

Your test passes 9 times out of 10, then fails randomly in CI. Here's what actually works:

  1. Run the test 50+ times locally - for i in {1..50}; do npm test -- --testNamePattern="flaky test"; done
  2. Check for timing issues - Add await page.waitForTimeout(1000) everywhere and see if it helps
  3. Look for shared state - Tests fucking with each other's data is the most common cause
  4. Environment differences - Different Node versions, timezone issues, different CPU speeds

VS Code Debug Console

The Debugger Console Is Your Friend:

When breakpoints don't work, use the Debug Console in VS Code:

// In the debug console:
> JSON.stringify(user, null, 2)  // Pretty print objects
> process.env.NODE_ENV           // Check environment
> global.something               // Inspect global state

VS Code Test Failures That'll Ruin Your Day:

"Cannot find any tests" Error:

Classic "Works on My Machine" Syndrome:

  • Node version differences (nvm use and check .nvmrc)
  • Timezone issues (tests with dates/times)
  • Missing environment variables
  • File path case sensitivity (macOS vs Linux)

VS Code Debugging

Breakpoints Refuse to Cooperate:

  1. Try debugger; statements instead
  2. Check source maps are enabled
  3. Disable code coverage during debugging
  4. Make sure you're debugging the right test file (VS Code sometimes gets confused)

VS Code Memory Issues During Testing:

// Add to settings.json
{
  "jest.autoRun": {
    "watch": false,
    "onSave": "test-src-file"
  },
  "testing.automaticallyOpenTesting": false
}

The Bottom Line on VS Code Testing

What Actually Works:

  • Test Explorer for visual feedback (when it's not broken)
  • debugger; statements over VS Code breakpoints
  • Manual test execution over auto-run (saves your sanity)
  • Playwright for E2E testing if you can handle the slowness

What Doesn't Work (But Everyone Tries):

  • Auto-running all tests on file save (kills VS Code performance)
  • Complex test coverage setups (just write more tests)
  • Trying to debug flaky tests instead of rewriting them
  • Running 50+ browser tests simultaneously in VS Code

The 80/20 Rule:

80% of your debugging time will be spent on:

  • Tests that work locally but fail in CI
  • Extensions conflicting with each other
  • Memory issues from running too many tests
  • Breakpoints that refuse to trigger

My Current VS Code Test Setup:

{
  "jest.autoRun": { "watch": false },
  "jest.showCoverageOnLoad": false,
  "testing.automaticallyOpenTesting": false,
  "typescript.preferences.includePackageJsonAutoImports": "off"
}

Simple setup that works for me. Might not be perfect for your project, but it's saved me from fighting with VS Code configs when I should be writing actual tests.

VS Code Testing Troubleshooting Guide

Q

VS Code Test Explorer isn't finding my tests. What the hell?

A

This happens to everyone. Here's the checklist:

  1. Is your test file named correctly? VS Code looks for *.test.js or *.spec.js. Weird naming patterns confuse it.
  2. Do you have a config file? Create jest.config.js even if it's just module.exports = {};
  3. Try the nuclear option: Cmd+Shift+P → "Developer: Reload Window"
  4. Still broken? Close VS Code, delete node_modules, npm install, restart everything.

If Test Explorer is still being a pain, just run tests from terminal. Sometimes it's faster than fighting with VS Code's attitude.

Q

My breakpoints don't work. VS Code is mocking me.

A

Yeah, this is the most frustrating part of VS Code testing. Here's what actually works:

Just use debugger; statements. Put debugger; right in your test code. It's ugly but it works 100% of the time.

If you insist on breakpoints:

  1. Make sure you're debugging the right test file (VS Code sometimes gets confused)
  2. Disable code coverage during debugging - it breaks source maps
  3. Add this to your Jest config: collectCoverage: false
  4. Try running the debugger from the terminal: node --inspect-brk node_modules/.bin/jest --runInBand

Real talk: I've given up on fixing breakpoint issues. debugger; works consistently for me, but maybe you'll have better luck with breakpoints.

Q

How do I run just one test without waiting forever?

A

The easy way: Click the little play button next to your test in Test Explorer. Works 80% of the time.

When that doesn't work:

  • Right-click the test and select "Run Test" (sometimes this works when clicking doesn't)
  • Use Ctrl+Shift+P → "Test: Run Test at Cursor" if your cursor is in the right place

The reliable way: Just add .only to your test:

test.only('this specific test', () => {
  // your test here
});

Don't forget to remove .only before committing. I've done this way too many times.

Q

My tests are slow as hell and VS Code keeps freezing.

A

VS Code + large test suites = pain. Here's what actually helps:

Turn off the performance killers:

{
  "jest.autoRun": {
    "watch": false,  // Auto-run kills VS Code
    "onStartup": []  // Don't run tests on startup
  },
  "testing.automaticallyOpenTesting": false,
  "jest.showCoverageOnLoad": false  // Coverage UI is a memory hog
}

Run fewer tests:

  • Use --maxWorkers=2 for Jest (don't max out your CPU)
  • Add --onlyChanged to only run tests for modified files
  • Consider splitting huge test files

When VS Code is acting up: Sometimes I just bail and run tests from terminal. npm test might be less fancy but it's reliable. Could be overkill for your use case though.

Q

Debugging async tests is a nightmare. Help?

A

Async debugging in VS Code is extra painful. Here's what works:

Use debugger; statements inside the async function:

test('async test', async () => {
  const result = await someAsyncFunction();
  debugger; // This works reliably
  expect(result).toBe('something');
});

Add await before your debugger line:

test('debugging async', async () => {
  await somePromise();
  debugger; // Wait for async stuff to finish first
  // your assertions here
});

Mock everything: Async tests that depend on real APIs are impossible to debug consistently. Use MSW or jest.mock() to make async code predictable.

Q

My Playwright tests work in terminal but break in VS Code.

A

This happens because VS Code's debugger environment is different from your terminal. Here's the fix:

Run Playwright with the browser visible:

// playwright.config.js
module.exports = {
  use: {
    headless: false,  // You need to see what's happening
    slowMo: 500,      // Slow down so you can follow along
  },
};

Use page.pause() to stop and inspect:

test('debugging test', async ({ page }) => {
  await page.goto('/login');
  await page.pause(); // Browser pauses, you can inspect manually
  await page.click('#submit');
});

Check the Playwright extension settings - sometimes it uses different config files than your terminal. Make sure it's pointing to the right playwright.config.js.

Q

How do I test stuff that depends on environment variables or APIs?

A

Environment variables: Just set them in your test setup:

// At the top of your test file
process.env.NODE_ENV = 'test';
process.env.API_KEY = 'fake-key-for-testing';

Mock Service Worker

API mocking: Use MSW (Mock Service Worker). It's the best solution:

// Install: npm install msw --save-dev
import { setupServer } from 'msw/node';
import { http, HttpResponse } from 'msw';

const server = setupServer(
  http.get('/api/user', () => {
    return HttpResponse.json({ name: 'Test User' });
  })
);

beforeAll(() => server.listen());
afterAll(() => server.close());

Don't overcomplicate it. Mock what you need, use fake data, ship it. Spending weeks perfecting your test setup is how you never actually write tests.

Q

My tests pass locally but fail in CI. Why?

A

Classic problem. Here's the checklist:

  1. Node version mismatch - CI is running Node 18, you're on Node 20. Check that .nvmrc file
  2. Timezone bullshit - Your tests assume PST but CI runs in UTC
  3. Missing env vars - CI doesn't have access to your .env.local secrets
  4. Case sensitivity - You wrote Components/Header.js but the file is components/header.js
  5. Race conditions - Works on your fast machine, fails on slow CI containers

Quick fix: Add debugging to see what's different in CI vs local.

Which Testing Framework Should You Use?

Framework

What It's Good For

VS Code Support

The Reality

Jest

Unit tests, mocking

Good (most of the time)

Everyone uses it. Lots of Stack Overflow answers.

Vitest

Modern projects with Vite

Good

Faster than Jest, but fewer resources when it breaks.

Playwright

Browser/E2E testing

Pretty good

Best E2E option. Slow but reliable.

Cypress

E2E with good debugging

Meh

Good for E2E but VS Code integration sucks.

When Your "Simple" Tests Aren't Cutting It Anymore

So you've got Jest working and breakpoints mostly cooperate. Great. Now here's the testing shit that'll bite you in the ass when you're actually running production systems.

This isn't beginner testing advice. This is for when your basic unit tests are passing but you're still getting paged during dinner because something broke in production in a way you never tested for. Been there. It sucks.

Property-Based Testing: When Random Shit Breaks Your Code

fast-check Logo

Started messing with property-based testing after getting burned by edge cases. Probably should've done it sooner, but you know how it is. Instead of writing specific test inputs like a normal person, you tell the testing framework "here's what should always be true" and it throws random garbage at your code until something breaks.

It's like having a really thorough QA person who hates your code and wants to find every possible way to break it.

Property-based testing in VS Code with fast-check

import fc from 'fast-check';

// Instead of testing specific string inputs
describe('string utilities', () => {
  test('reverse function is involutive', () => {
    fc.assert(fc.property(fc.string(), (str) => {
      expect(reverse(reverse(str))).toBe(str);
    }));
  });
  
  test('sort function produces ordered output', () => {
    fc.assert(fc.property(fc.array(fc.integer()), (arr) => {
      const sorted = sort(arr);
      for (let i = 0; i < sorted.length - 1; i++) {
        expect(sorted[i]).toBeLessThanOrEqual(sorted[i + 1]);
      }
    }));
  });
});

When property-based tests fail

in VS Code, fast-check tries to "shrink" the failing input down to the simplest case that still breaks your code. This is usually where you discover your assumptions are wrong.

Had this payment thing break when someone pasted emoji into the amount field. Still not sure how they managed that, but property-based testing caught it. Might've been Unicode normalization issues? Either way, now I test with random garbage because users are creative in ways you can't imagine.

Mutation Testing: Finding Out Your Tests Are Garbage

Stryker Mutator Logo

Mutation testing is like having someone sabotage your code to see if your tests actually catch anything. Spoiler alert: they probably don't catch as much as you think.

The idea is simple but brutal - it automatically introduces bugs into your code (flip a true to false, change > to >=, remove statements) and runs your test suite. If your tests still pass, your tests are shit.

Mutation testing with Stryker in VS Code

// stryker.conf.js
module.exports = {
  mutate: [
    'src/**/*.js',
    '!src/**/*.test.js'
  ],
  testRunner: 'jest',
  reporters: ['progress', 'clear-text', 'html'],
  coverageAnalysis: 'perTest',
  jest: {
    projectType: 'custom',
    configFile: 'jest.config.js'
  }
};

Tried Stryker on what I thought was solid code. Found a bunch of ways to break stuff that my tests missed. Reality check, for sure.

Fair warning

Mutation testing is slow as hell. Runs your entire test suite for every tiny change it makes. Don't run it on everything or you'll be waiting forever - stick to the critical stuff that would actually break things.

Contract Testing: When Microservices Hate Each Other

Contract testing is for when you're working with microservices and tired of integration tests that break every time someone changes an API. Instead of spinning up 47 different services just to test one endpoint, you test against a contract that defines how services should talk to each other.

This might've saved my ass when our payment service changed their response format. Pretty sure contract tests would've caught it, but honestly we were moving too fast to set them up properly. Learned that lesson the hard way.

Contract testing with Pact in VS Code

// Consumer contract test
import { Pact } from '@pact-foundation/pact';
import { UserService } from '../userService';

describe('User Service Contract', () => {
  const provider = new Pact({
    consumer: 'UserConsumer',
    provider: 'UserProvider',
    port: 1234,
  });

  beforeAll(() => provider.setup());
  afterEach(() => provider.verify());
  afterAll(() => provider.finalize());

  test('should get user by ID', async () => {
    await provider
      .given('user with ID 123 exists')
      .uponReceiving('a request for user 123')
      .withRequest({
        method: 'GET',
        path: '/users/123',
        headers: {
          'Accept': 'application/json',
        },
      })
      .willRespondWith({
        status: 200,
        headers: {
          'Content-Type': 'application/json',
        },
        body: {
          id: 123,
          name: 'John Doe',
          email: 'john@example.com',
        },
      });

    const user = await new UserService().getUser(123);
    expect(user.name).toBe('John Doe');
  });
});

Contract testing debugging

in VS Code involves verifying both consumer and provider sides of API contracts. Set breakpoints in contract tests to examine request/response structures and ensure they match expected schemas.

Contract testing workflow benefits

  • Detect API compatibility issues before deployment
  • Enable independent service development and testing
  • Reduce the need for complex integration testing environments
  • Catch breaking changes during contract verification

Chaos Engineering: Breaking Things on Purpose

Chaos engineering is when you intentionally break your own shit to see what happens. Sounds crazy, but it's better to find out your database connection pooling sucks during development than during Black Friday traffic.

Started doing this after AWS had one of their "moments" and our db connections died. Probably should've been testing this stuff earlier, but hindsight and all that.

Chaos testing in development environments

// Chaos testing with network failures
describe('resilience testing', () => {
  test('handles network timeouts gracefully', async () => {
    // Simulate network timeout
    nock('https://api.example.com')
      .get('/users/123')
      .delay(5000) // 5 second delay
      .reply(200, { id: 123, name: 'John' });

    const userService = new UserService({ timeout: 1000 });
    
    await expect(userService.getUser(123)).rejects.toThrow('Timeout');
    
    // Verify graceful degradation
    const fallbackUser = await userService.getUserWithFallback(123);
    expect(fallbackUser.name).toBe('Unknown User');
  });

  test('handles database connection failures', async () => {
    // Simulate database connection failure
    const mockDb = {
      connect: jest.fn().mockRejectedValue(new Error('Connection failed')),
      query: jest.fn()
    };

    const userService = new UserService(mockDb);
    
    await expect(userService.getUser(123)).rejects.toThrow();
    
    // Verify circuit breaker behavior
    expect(mockDb.connect).toHaveBeenCalledTimes(3); // Retry logic
  });
});

Chaos testing categories

  • Network chaos: Timeouts, connection failures, packet loss
  • Resource chaos: Memory pressure, CPU exhaustion, disk space
  • Dependency chaos: Database failures, external service outages
  • Configuration chaos: Invalid configuration, missing environment variables

Debugging chaos test failures

requires understanding system behavior under stress. Use VS Code's debugger to step through error handling code paths and verify that systems degrade gracefully rather than failing catastrophically.

Performance Testing: When "It Works on My Machine" Isn't Enough

Performance testing is where you discover your code that runs fine locally turns into molasses in production. Found this out when our search went from 200ms locally to 12 seconds in prod. Turns out my test data was laughably small. Whoops.

Micro-benchmark testing with Benchmark.js

import Benchmark from 'benchmark';

describe('performance benchmarks', () => {
  test('array sorting performance', (done) => {
    const suite = new Benchmark.Suite();
    
    const largeArray = Array.from({ length: 10000 }, () => 
      Math.floor(Math.random() * 1000)
    );
    
    suite
      .add('native sort', () => {
        [...largeArray].sort((a, b) => a - b);
      })
      .add('custom quicksort', () => {
        quickSort([...largeArray]);
      })
      .on('cycle', (event) => {
        console.log(String(event.target));
      })
      .on('complete', function() {
        const fastest = this.filter('fastest')[0];
        expect(fastest.name).toMatch(/sort/); // Verify performance expectations
        done();
      })
      .run({ async: true });
  });
});

Performance regression testing

catches performance degradations during development:

describe('performance regression tests', () => {
  test('user search should complete within performance budget', async () => {
    const startTime = performance.now();
    
    await userService.searchUsers('john', { limit: 100 });
    
    const duration = performance.now() - startTime;
    expect(duration).toBeLessThan(500); // 500ms performance budget
  });

  test('bulk data processing should scale linearly', async () => {
    const sizes = [100, 1000, 10000];
    const results = [];
    
    for (const size of sizes) {
      const data = generateTestData(size);
      const startTime = performance.now();
      
      await dataProcessor.process(data);
      
      const duration = performance.now() - startTime;
      results.push({ size, duration });
    }
    
    // Verify linear scaling (O(n))
    const ratios = results.map((r, i) => 
      i > 0 ? r.duration / results[i-1].duration : 1
    ).slice(1);
    
    ratios.forEach(ratio => {
      expect(ratio).toBeLessThan(15); // Should not exceed 15x for 10x data
    });
  });
});

Performance testing debugging

in VS Code involves profiling code execution and identifying performance bottlenecks. Use VS Code's profiling extensions to capture CPU and memory usage during performance tests.

Security Testing: Because Users Are Assholes

Users will try to break your shit. Not maliciously (usually), but they'll paste SQL injection attempts into form fields because they saw it in a movie. Better to catch this stuff in development than get owned in production and end up on HaveIBeenPwned.

Security testing with Jest and security-focused libraries

describe('security tests', () => {
  test('input validation prevents SQL injection', () => {
    const maliciousInputs = [
      "'; DROP TABLE users; --",
      "1' OR '1'='1",
      "admin'/*",
      "1; DELETE FROM users WHERE 1=1; --"
    ];
    
    maliciousInputs.forEach(input => {
      expect(() => {
        userService.getUserById(input);
      }).toThrow('Invalid input');
    });
  });

  test('authentication requires valid credentials', async () => {
    const authService = new AuthService();
    
    // Test with missing credentials
    await expect(authService.login()).rejects.toThrow('Missing credentials');
    
    // Test with invalid credentials
    await expect(authService.login('admin', 'password123'))
      .rejects.toThrow('Invalid credentials');
      
    // Test with empty credentials
    await expect(authService.login('', ''))
      .rejects.toThrow('Invalid credentials');
  });

  test('sensitive data is not logged', () => {
    const logSpy = jest.spyOn(console, 'log');
    
    userService.processPayment({
      amount: 100,
      creditCard: '4111-1111-1111-1111',
      cvv: '123'
    });
    
    // Verify sensitive data doesn't appear in logs
    const logCalls = logSpy.mock.calls.flat().join(' ');
    expect(logCalls).not.toMatch(/4111-1111-1111-1111/);
    expect(logCalls).not.toMatch(/123/);
    
    logSpy.mockRestore();
  });
});

Security testing categories

  • Input validation: SQL injection, XSS, command injection
  • Authentication testing: Credential validation, session management
  • Authorization testing: Access control, privilege escalation
  • Data protection: Encryption, sensitive data handling

Security test debugging

focuses on understanding attack vectors and verifying that security controls work as expected. Use VS Code's debugger to step through security validation code and ensure it correctly handles malicious inputs.

Visual Regression Testing: When CSS Changes Break Everything

Visual regression testing is for catching the CSS changes that make your buttons disappear or move text off-screen. Started using this after some CSS change broke our checkout. Button ended up behind the sidebar or something. Took way too long to notice.

Visual regression testing with Playwright and VS Code

import { test, expect } from '@playwright/test';

test.describe('visual regression tests', () => {
  test('homepage layout remains consistent', async ({ page }) => {
    await page.goto('/');
    
    // Wait for dynamic content to load
    await page.waitForSelector('[data-testid="user-dashboard"]');
    
    // Take screenshot and compare with baseline
    await expect(page).toHaveScreenshot('homepage.png');
  });

  test('modal dialog appears correctly', async ({ page }) => {
    await page.goto('/dashboard');
    await page.click('[data-testid="open-settings"]');
    
    // Wait for modal animation to complete
    await page.waitForTimeout(500);
    
    await expect(page).toHaveScreenshot('settings-modal.png');
  });
});

Visual testing debugging

in VS Code involves examining screenshot diffs to understand what changed. VS Code's Playwright extension shows visual diffs directly in the editor, making it easy to identify layout changes.

Visual regression testing challenges

  • Font rendering differences between operating systems and browsers
  • Animation timing causing inconsistent screenshots
  • Dynamic content like timestamps or user-generated content
  • Screen resolution and viewport size variations

Testing in Production: Monitoring and Observability

Advanced testing extends beyond development environments into production monitoring and observability.

Synthetic monitoring tests

// Synthetic monitoring with Playwright
test('production health check', async ({ page }) => {
  await page.goto(process.env.PRODUCTION_URL);
  
  // Verify critical user paths work in production
  await page.fill('[data-testid="search"]', 'test query');
  await page.click('[data-testid="search-button"]');
  
  // Verify search results appear within performance budget
  await expect(page.locator('[data-testid="search-results"]')).toBeVisible({
    timeout: 5000
  });
  
  // Verify no JavaScript errors
  const errors = [];
  page.on('pageerror', error => errors.push(error));
  
  expect(errors).toHaveLength(0);
});

Feature flag testing

describe('feature flag testing', () => {
  test('new feature works when flag is enabled', async () => {
    process.env.NEW_FEATURE_ENABLED = 'true';
    
    const result = await featureService.processRequest(testData);
    
    expect(result.newFeatureUsed).toBe(true);
  });

  test('fallback works when flag is disabled', async () => {
    process.env.NEW_FEATURE_ENABLED = 'false';
    
    const result = await featureService.processRequest(testData);
    
    expect(result.newFeatureUsed).toBe(false);
    expect(result.fallbackUsed).toBe(true);
  });
});

When NOT to Use This Stuff

Not every project needs this stuff. Building a simple CRUD app? Property-based testing is probably overkill. But if downtime costs actual money, these techniques might save your ass.

Start with performance testing - it's the easiest way to catch problems before users complain. Add security testing if you handle user data. Use property-based testing for complex business logic. Save mutation testing and chaos engineering for mission-critical systems.

The goal isn't to implement every advanced testing technique. The goal is to sleep better at night knowing your production systems won't randomly explode during your kid's birthday party.

Related Tools & Recommendations

compare
Recommended

Cursor vs GitHub Copilot vs Codeium vs Tabnine vs Amazon Q - Which One Won't Screw You Over

After two years using these daily, here's what actually matters for choosing an AI coding tool

Cursor
/compare/cursor/github-copilot/codeium/tabnine/amazon-q-developer/windsurf/market-consolidation-upheaval
100%
review
Recommended

GitHub Copilot vs Cursor: Which One Pisses You Off Less?

I've been coding with both for 3 months. Here's which one actually helps vs just getting in the way.

GitHub Copilot
/review/github-copilot-vs-cursor/comprehensive-evaluation
86%
compare
Recommended

I Tried All 4 Major AI Coding Tools - Here's What Actually Works

Cursor vs GitHub Copilot vs Claude Code vs Windsurf: Real Talk From Someone Who's Used Them All

Cursor
/compare/cursor/claude-code/ai-coding-assistants/ai-coding-assistants-comparison
63%
compare
Recommended

Augment Code vs Claude Code vs Cursor vs Windsurf

Tried all four AI coding tools. Here's what actually happened.

windsurf
/compare/augment-code/claude-code/cursor/windsurf/enterprise-ai-coding-reality-check
62%
integration
Similar content

Pieces VS Code Copilot Multi-AI Workflow Setup & MCP Guide

Integrate Pieces with VS Code Copilot for multi-AI workflows using Model Context Protocol (MCP). Learn setup, debugging, and enterprise deployment strategies to

Pieces
/integration/pieces-vscode-copilot/mcp-multi-ai-architecture
59%
tool
Similar content

Visual Studio Code: The Editor's Rise, Pros & Cons

Microsoft made a decent editor and gave it away for free. Everyone switched.

Visual Studio Code
/tool/visual-studio-code/overview
52%
pricing
Recommended

GitHub Copilot Enterprise Pricing - What It Actually Costs

GitHub's pricing page says $39/month. What they don't tell you is you're actually paying $60.

GitHub Copilot Enterprise
/pricing/github-copilot-enterprise-vs-competitors/enterprise-cost-calculator
49%
tool
Similar content

Prettier Troubleshooting: Fix Format-on-Save & Common Failures

Solve common Prettier issues: fix format-on-save, debug monorepo configuration, resolve CI/CD formatting disasters, and troubleshoot VS Code errors for consiste

Prettier
/tool/prettier/troubleshooting-failures
49%
tool
Similar content

Qodo (formerly Codium) - AI That Actually Tests Your Code

Discover Qodo (formerly Codium), the AI code testing tool. Understand its rebranding, learn to set up the Qodo Gen IDE plugin, and see how it compares to other

Qodo
/tool/qodo/overview
47%
tool
Similar content

Advanced Debugging & Security in Visual Studio Code: A Pro's Guide

VS Code has real debugging tools that actually work. Stop spamming console.log and learn to debug properly.

Visual Studio Code
/tool/visual-studio-code/advanced-debugging-security-guide
47%
tool
Similar content

Visual Studio Code: Fix Team Settings & Enterprise Configuration

Your team's VS Code setup is chaos. Same codebase, 12 different formatting styles. Time to unfuck it.

Visual Studio Code
/tool/visual-studio-code/configuration-management-enterprise
47%
tool
Recommended

Windsurf Memory Gets Out of Control - Here's How to Fix It

Stop Windsurf from eating all your RAM and crashing your dev machine

Windsurf
/tool/windsurf/enterprise-performance-optimization
42%
integration
Recommended

Build Trading Bots That Actually Work - IB API Integration That Won't Ruin Your Weekend

TWS Socket API vs REST API - Which One Won't Break at 3AM

Interactive Brokers API
/integration/interactive-brokers-nodejs/overview
39%
integration
Recommended

Claude API Code Execution Integration - Advanced Tools Guide

Build production-ready applications with Claude's code execution and file processing tools

Claude API
/integration/claude-api-nodejs-express/advanced-tools-integration
39%
integration
Recommended

Redis + Node.js Integration Guide

depends on Redis

Redis
/integration/redis-nodejs/nodejs-integration-guide
39%
tool
Similar content

Cursor AI: VS Code with Smart AI for Developers

It's basically VS Code with actually smart AI baked in. Works pretty well if you write code for a living.

Cursor
/tool/cursor/overview
38%
tool
Similar content

Visual Studio Code AI Integration: Agent Mode Reality Check

VS Code's Agent Mode finally connects AI to your actual tools instead of just generating code in a vacuum

Visual Studio Code
/tool/visual-studio-code/ai-integration-reality-check
36%
tool
Similar content

VS Code Team Collaboration: Master Workspaces & Remote Dev

How to wrangle multi-project chaos, remote development disasters, and team configuration nightmares without losing your sanity

Visual Studio Code
/tool/visual-studio-code/workspace-team-collaboration
36%
tool
Similar content

GitHub Copilot Performance: Troubleshooting & Optimization

Reality check on performance - Why VS Code kicks the shit out of JetBrains for AI suggestions

GitHub Copilot
/tool/github-copilot/performance-troubleshooting
36%
tool
Similar content

Cursor Background Agents & Bugbot Troubleshooting Guide

Troubleshoot common issues with Cursor Background Agents and Bugbot. Solve 'context too large' errors, fix GitHub integration problems, and optimize configurati

Cursor
/tool/cursor/agents-troubleshooting
36%

Recommendations combine user behavior, content similarity, research intelligence, and SEO optimization