generating-unit-tests — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited generating-unit-tests (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
For changed files:
git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(js|jsx|ts|tsx|vue)$' | grep -v '\.test\.|\.spec\.'For specific file, derive test path:
src/utils/format.ts → src/utils/format.test.ts or __tests__/utils/format.test.ts| Framework | Config Files | Test Pattern |
|---|---|---|
| Jest | jest.config.*, package.json (jest key) | *.test.{js,ts,tsx} |
| Vitest | vitest.config.*, vite.config.* | *.test.{js,ts,tsx} |
| Playwright | playwright.config.* | *.spec.{js,ts} |
| Mocha | .mocharc.*, package.json (mocha key) | *.test.{js,ts} |
Check installed framework:
npm ls jest vitest @playwright/test mocha 2>/dev/nullExtract testable units:
Identify inputs and outputs:
Jest/Vitest template:
import { describe, it, expect, vi } from "vitest"; // or from '@jest/globals'
import { functionName } from "../path/to/module";
describe("functionName", () => {
it("should handle normal input", () => {
expect(functionName(validInput)).toBe(expectedOutput);
});
it("should handle edge case", () => {
expect(functionName(edgeInput)).toBe(edgeOutput);
});
it("should throw on invalid input", () => {
expect(() => functionName(invalidInput)).toThrow(ExpectedError);
});
});React component template:
import { render, screen, fireEvent } from '@testing-library/react';
import { Component } from '../Component';
describe('Component', () => {
it('renders with default props', () => {
render(<Component />);
expect(screen.getByRole('button')).toBeInTheDocument();
});
it('handles user interaction', async () => {
const onAction = vi.fn();
render(<Component onAction={onAction} />);
fireEvent.click(screen.getByRole('button'));
expect(onAction).toHaveBeenCalledOnce();
});
});Playwright E2E template:
import { test, expect } from "@playwright/test";
test.describe("Feature", () => {
test("should complete user flow", async ({ page }) => {
await page.goto("/path");
await page.click('button[data-testid="action"]');
await expect(page.locator(".result")).toBeVisible();
});
});Always generate tests for:
Execute tests:
# Jest
npx jest --testPathPattern="<test-file>" --coverage
# Vitest
npx vitest run <test-file> --coverage
# Playwright
npx playwright test <test-file>
# Mocha
npx mocha <test-file>View coverage report:
# Jest/Vitest generate coverage in ./coverage/
open coverage/lcov-report/index.htmlCoverage targets:
Mock external modules:
vi.mock("../api", () => ({
fetchData: vi.fn().mockResolvedValue({ data: "mocked" }),
}));Mock timers:
vi.useFakeTimers();
vi.advanceTimersByTime(1000);
vi.useRealTimers();Mock environment:
const originalEnv = process.env;
beforeEach(() => {
process.env = { ...originalEnv, API_KEY: "test-key" };
});
afterEach(() => {
process.env = originalEnv;
});Before completing:
npm install --save-dev <framework>.vi.mock hoisting in Vitest.--coverage flag and check config for coverage settings.npx <framework> --help.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.