← Home

🃏

⌘K
ðŸĪ–
Claude Code AI Tools
ðŸĪ—
Hugging Face AI Tools
ðŸĶœ
LangChain AI Tools
🧠
Keras AI Tools
ðŸĶ™
Ollama AI Tools
🐍
Python Programming Languages
ðŸŸĻ
JavaScript Programming Languages
🔷
TypeScript Programming Languages
⚛ïļ
React Programming Languages
ðŸđ
Go Programming Languages
ðŸĶ€
Rust Programming Languages
📊
MATLAB Programming Languages
🗄ïļ
SQL Programming Languages
⚙ïļ
C/C++ Programming Languages
☕
Java Programming Languages
ðŸŸĢ
C# Programming Languages
🍎
Swift Programming Languages
🟠
Kotlin Programming Languages
â–ē
Next.js Programming Languages
💚
Vue.js Programming Languages
ðŸ”Ĩ
Svelte Programming Languages
ðŸŽĻ
Tailwind CSS Programming Languages
💚
Node.js Programming Languages
🌐
HTML Programming Languages
ðŸŽĻ
CSS/SCSS Programming Languages
🐘
PHP Programming Languages
💎
Ruby Programming Languages
ðŸ”ī
Scala Programming Languages
📊
R Programming Languages
ðŸŽŊ
Dart Programming Languages
💧
Elixir Programming Languages
🌙
Lua Programming Languages
🐊
Perl Programming Languages
🅰ïļ
Angular Programming Languages
🚂
Express.js Programming Languages
ðŸą
NestJS Programming Languages
ðŸ›Īïļ
Ruby on Rails Programming Languages
◾ïļ
GraphQL Programming Languages
🟊
Haskell Programming Languages
💚
Nuxt.js Programming Languages
🔷
SolidJS Programming Languages
⚡
htmx Programming Languages
ðŸ’ŧ
VS Code Development Tools
🧠
PyCharm Development Tools
📓
Jupyter Development Tools
🧠
IntelliJ IDEA Development Tools
💚
Neovim Development Tools
ðŸ”Ū
Emacs Development Tools
🔀
Git DevOps & CLI
ðŸģ
Docker DevOps & CLI
â˜ļïļ
Kubernetes DevOps & CLI
☁ïļ
AWS CLI DevOps & CLI
🔄
GitHub Actions DevOps & CLI
🐧
Linux Commands DevOps & CLI
ðŸ’ŧ
Bash Scripting DevOps & CLI
🌐
Nginx DevOps & CLI
📝
Vim DevOps & CLI
ðŸ”Ļ
Makefile DevOps & CLI
🧊
Pytest DevOps & CLI
🊟
Windows DevOps & CLI
ðŸ“Ķ
Package Managers DevOps & CLI
🍎
macOS DevOps & CLI
🏗ïļ
Terraform DevOps & CLI
🔧
Ansible DevOps & CLI
⎈
Helm DevOps & CLI
ðŸ”Ļ
Jenkins DevOps & CLI
ðŸ”Ĩ
Prometheus DevOps & CLI
📊
Grafana DevOps & CLI
ðŸ’ŧ
Zsh DevOps & CLI
🐟
Fish Shell DevOps & CLI
💙
PowerShell DevOps & CLI
🔄
Argo CD DevOps & CLI
🔀
Traefik DevOps & CLI
☁ïļ
Azure CLI DevOps & CLI
☁ïļ
Google Cloud CLI DevOps & CLI
📟
tmux DevOps & CLI
🔧
jq DevOps & CLI
✂ïļ
sed DevOps & CLI
📊
awk DevOps & CLI
🌊
Apache Airflow DevOps & CLI
ðŸ”Ē
NumPy Databases & Data
🐞
Pandas Databases & Data
ðŸ”Ĩ
PyTorch Databases & Data
🧠
TensorFlow Databases & Data
📈
Matplotlib Databases & Data
🐘
PostgreSQL Databases & Data
🐎
MySQL Databases & Data
🍃
MongoDB Databases & Data
ðŸ”ī
Redis Databases & Data
🔍
Elasticsearch Databases & Data
ðŸĪ–
Scikit-learn Databases & Data
👁ïļ
OpenCV Databases & Data
⚡
Apache Spark Databases & Data
ðŸŠķ
SQLite Databases & Data
⚡
Supabase Databases & Data
ðŸ”ĩ
Neo4j Databases & Data
ðŸ“Ļ
Apache Kafka Databases & Data
🐰
RabbitMQ Databases & Data
ðŸ”Ī
Regex Utilities
📝
Markdown Utilities
📄
LaTeX Utilities
🔐
SSH & GPG Utilities
🌐
curl & HTTP Utilities
📜
reStructuredText Utilities
🚀
Postman Utilities
🎎
FFmpeg Utilities
🖞ïļ
ImageMagick Utilities
🔍
ripgrep Utilities
🔍
fzf Utilities
📗
Microsoft Excel Office Applications
📘
Microsoft Word Office Applications
📙
Microsoft PowerPoint Office Applications
📝
Hancom Hangul Hancom Office
ðŸ“―ïļ
Hancom Hanshow Hancom Office
📊
Hancom Hancell Hancom Office
📄
Google Docs Google Workspace
📊
Google Sheets Google Workspace
ðŸ“―ïļ
Google Slides Google Workspace
🔌
Cadence Virtuoso EDA & Hardware
⚙ïļ
Synopsys EDA EDA & Hardware
💎
Verilog & VHDL EDA & Hardware
⚡
LTSpice EDA & Hardware
🔧
KiCad EDA & Hardware
📝
Notion Productivity
💎
Obsidian Productivity
💎
Slack Productivity
ðŸŽŪ
Discord Productivity
ðŸŽĻ
Figma Design Tools
📘
Confluence Atlassian
📋
Jira Atlassian
🃏
Jest Testing
⚡
Vitest Testing
🎭
Playwright Testing
ðŸŒē
Cypress Testing
🌐
Selenium Testing
💙
Flutter Mobile Development
ðŸ“ą
React Native Mobile Development
🍎
SwiftUI Mobile Development
ðŸ“ą
Expo Mobile Development
🐍
Django Web Frameworks
⚡
FastAPI Web Frameworks
ðŸŒķïļ
Flask Web Frameworks
🍃
Spring Boot Web Frameworks
ðŸļ
Gin Web Frameworks
⚡
Vite Build Tools
ðŸ“Ķ
Webpack Build Tools
⚡
esbuild Build Tools
🐘
Gradle Build Tools
ðŸŠķ
Maven Build Tools
🔧
CMake Build Tools
ðŸŽŪ
Unity Game Development
ðŸĪ–
Godot Game Development
🔌
Arduino Embedded & IoT
🔍
Nmap Security
🐕
Datadog Monitoring
📖
Swagger/OpenAPI Documentation
No results found
EN KO

Basics

CLI Commands

npm install --save-dev jest Install Jest
npx jest Run all tests
npx jest --watch Watch mode
npx jest --coverage With coverage
npx jest path/to/test.js Run specific file
npx jest -t "test name" Run matching tests
npx jest --verbose Verbose output
npx jest --updateSnapshot Update snapshots

Test Structure

Basic test
test('adds 1 + 2 to equal 3', () => {
  expect(1 + 2).toBe(3);
});
Using it()
it('should add numbers', () => {
  expect(add(1, 2)).toBe(3);
});
Describe block
describe('Calculator', () => {
  describe('add', () => {
    it('adds two numbers', () => {
      expect(add(1, 2)).toBe(3);
    });
  });
});
Skip test
test.skip('skipped test', () => {});
xtest('also skipped', () => {});
Only run
test.only('only this runs', () => {});
fit('also only this', () => {});

Matchers

Common Matchers

Exact equality
expect(value).toBe(expected);
Deep equality
expect(obj).toEqual({ a: 1, b: 2 });
Not
expect(value).not.toBe(expected);
Truthiness
expect(value).toBeTruthy();
expect(value).toBeFalsy();
expect(value).toBeNull();
expect(value).toBeUndefined();
expect(value).toBeDefined();
Numbers
expect(value).toBeGreaterThan(3);
expect(value).toBeGreaterThanOrEqual(3);
expect(value).toBeLessThan(5);
expect(value).toBeLessThanOrEqual(5);
expect(0.1 + 0.2).toBeCloseTo(0.3);

String & Array Matchers

String match
expect('hello world').toMatch(/world/);
expect(str).toContain('substring');
Array contains
expect([1, 2, 3]).toContain(2);
expect([{a: 1}, {b: 2}]).toContainEqual({a: 1});
Array length
expect([1, 2, 3]).toHaveLength(3);
Object property
expect(obj).toHaveProperty('name');
expect(obj).toHaveProperty('user.name', 'John');

Exception Matchers

Throw error
expect(() => {
  throw new Error('error');
}).toThrow();

expect(() => fn()).toThrow('specific message');
expect(() => fn()).toThrow(Error);
Async error
await expect(asyncFn()).rejects.toThrow();

Async Testing

Async Tests

Async/await
test('async test', async () => {
  const data = await fetchData();
  expect(data).toBe('data');
});
Promises
test('promise test', () => {
  return fetchData().then(data => {
    expect(data).toBe('data');
  });
});
Resolves/Rejects
test('resolves', async () => {
  await expect(fetchData()).resolves.toBe('data');
});

test('rejects', async () => {
  await expect(fetchBadData()).rejects.toThrow();
});
Done callback
test('callback test', done => {
  fetchData(data => {
    expect(data).toBe('data');
    done();
  });
});

Mocking

Mock Functions

Create mock
const mockFn = jest.fn();
mockFn('arg1', 'arg2');

expect(mockFn).toHaveBeenCalled();
expect(mockFn).toHaveBeenCalledWith('arg1', 'arg2');
expect(mockFn).toHaveBeenCalledTimes(1);
Return value
const mockFn = jest.fn()
  .mockReturnValue('default')
  .mockReturnValueOnce('first')
  .mockReturnValueOnce('second');
Mock implementation
const mockFn = jest.fn()
  .mockImplementation(x => x * 2);
Async mock
const mockFn = jest.fn()
  .mockResolvedValue('data')
  .mockResolvedValueOnce('first');

// Or
.mockRejectedValue(new Error('error'));

Module Mocking

Mock module
jest.mock('./module');

import { fetchData } from './module';
fetchData.mockResolvedValue('mocked data');
Partial mock
jest.mock('./module', () => ({
  ...jest.requireActual('./module'),
  fetchData: jest.fn()
}));
Mock axios
jest.mock('axios');
import axios from 'axios';

axios.get.mockResolvedValue({ data: 'mocked' });
Clear mocks
beforeEach(() => {
  jest.clearAllMocks();  // Clear calls
  jest.resetAllMocks();  // Reset implementations
  jest.restoreAllMocks(); // Restore original
});

Spies

Spy on method
const spy = jest.spyOn(object, 'method');
object.method();

expect(spy).toHaveBeenCalled();
spy.mockRestore();
Spy with implementation
const spy = jest.spyOn(console, 'log')
  .mockImplementation(() => {});

Setup & Teardown

Lifecycle Hooks

Before/After all
beforeAll(() => {
  // Runs once before all tests
});

afterAll(() => {
  // Runs once after all tests
});
Before/After each
beforeEach(() => {
  // Runs before each test
});

afterEach(() => {
  // Runs after each test
});
Scoped hooks
describe('group', () => {
  beforeEach(() => {
    // Only for tests in this describe
  });

  test('test 1', () => {});
  test('test 2', () => {});
});

Snapshot Testing

Snapshots

Basic snapshot
test('matches snapshot', () => {
  const component = render(<Button />);
  expect(component).toMatchSnapshot();
});
Inline snapshot
test('inline snapshot', () => {
  expect(getData()).toMatchInlineSnapshot(`
    Object {
      "name": "John",
    }
  `);
});
Property matcher
expect(user).toMatchSnapshot({
  createdAt: expect.any(Date),
  id: expect.any(Number)
});

Timer Mocks

Fake Timers

Use fake timers
jest.useFakeTimers();

test('timer test', () => {
  const callback = jest.fn();
  setTimeout(callback, 1000);

  jest.advanceTimersByTime(1000);
  expect(callback).toHaveBeenCalled();
});
Run all timers
jest.runAllTimers();
jest.runOnlyPendingTimers();
Restore timers
afterEach(() => {
  jest.useRealTimers();
});

Configuration

jest.config.js

Basic config
module.exports = {
  testEnvironment: 'node',
  roots: ['<rootDir>/src'],
  testMatch: ['**/*.test.js'],
  collectCoverage: true,
  coverageDirectory: 'coverage',
  coverageThreshold: {
    global: {
      branches: 80,
      functions: 80,
      lines: 80
    }
  }
};
Setup files
module.exports = {
  setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
  globalSetup: '<rootDir>/globalSetup.js',
  globalTeardown: '<rootDir>/globalTeardown.js'
};
Module mapping
module.exports = {
  moduleNameMapper: {
    '^@/(.*)$': '<rootDir>/src/$1',
    '\\.(css|scss)$': 'identity-obj-proxy'
  }
};