format: apply repo prettier (3.8.1) to the folded skills tree

963 markdown files reformatted with the repository's pinned prettier so
pnpm format:check covers the folded tree like every other repo file.

The formatter's embedded-language pass also normalized code fences
(TS semicolons, closed HTML tags in examples, lowercased CSS hex colors,
one renumbered list that skipped an index). Alphanumeric token deltas vs
the fold commit were audited file-by-file; all are formatter-equivalent
markup normalizations plus the four sanitized skills.
This commit is contained in:
fargo
2026-08-19 14:37:17 -05:00
parent d2eeb64433
commit 1a822493ba
962 changed files with 29594 additions and 27188 deletions
@@ -11,10 +11,10 @@ Every test receives context as first argument:
```ts
test('context', ({ task, expect, skip }) => {
console.log(task.name) // Test name
expect(1).toBe(1) // Context-bound expect
skip() // Skip test dynamically
})
console.log(task.name); // Test name
expect(1).toBe(1); // Context-bound expect
skip(); // Skip test dynamically
});
```
### Context Properties
@@ -30,39 +30,39 @@ test('context', ({ task, expect, skip }) => {
Create reusable test utilities:
```ts
import { test as base } from 'vitest'
import { test as base } from 'vitest';
// Define fixture types
interface Fixtures {
db: Database
user: User
db: Database;
user: User;
}
// Create extended test
export const test = base.extend<Fixtures>({
// Fixture with setup/teardown
db: async ({}, use) => {
const db = await createDatabase()
await use(db) // Provide to test
await db.close() // Cleanup
const db = await createDatabase();
await use(db); // Provide to test
await db.close(); // Cleanup
},
// Fixture depending on another fixture
user: async ({ db }, use) => {
const user = await db.createUser({ name: 'Test' })
await use(user)
await db.deleteUser(user.id)
const user = await db.createUser({ name: 'Test' });
await use(user);
await db.deleteUser(user.id);
},
})
});
```
Using fixtures:
```ts
test('query user', async ({ db, user }) => {
const found = await db.findUser(user.id)
expect(found).toEqual(user)
})
const found = await db.findUser(user.id);
expect(found).toEqual(user);
});
```
## Fixture Initialization
@@ -72,13 +72,13 @@ Fixtures only initialize when accessed:
```ts
const test = base.extend({
expensive: async ({}, use) => {
console.log('initializing') // Only runs if test uses it
await use('value')
console.log('initializing'); // Only runs if test uses it
await use('value');
},
})
});
test('no fixture', () => {}) // expensive not called
test('uses fixture', ({ expensive }) => {}) // expensive called
test('no fixture', () => {}); // expensive not called
test('uses fixture', ({ expensive }) => {}); // expensive called
```
## Auto Fixtures
@@ -89,13 +89,13 @@ Run fixture for every test:
const test = base.extend({
setup: [
async ({}, use) => {
await globalSetup()
await use()
await globalTeardown()
await globalSetup();
await use();
await globalTeardown();
},
{ auto: true } // Always run
{ auto: true }, // Always run
],
})
});
```
## Scoped Fixtures
@@ -108,13 +108,13 @@ Initialize once per file:
const test = base.extend({
connection: [
async ({}, use) => {
const conn = await connect()
await use(conn)
await conn.close()
const conn = await connect();
await use(conn);
await conn.close();
},
{ scope: 'file' }
{ scope: 'file' },
],
})
});
```
### Worker Scope
@@ -125,11 +125,11 @@ Initialize once per worker:
const test = base.extend({
sharedResource: [
async ({}, use) => {
await use(globalResource)
await use(globalResource);
},
{ scope: 'worker' }
{ scope: 'worker' },
],
})
});
```
## Injected Fixtures (from Config)
@@ -140,7 +140,7 @@ Override fixtures per project:
// test file
const test = base.extend({
apiUrl: ['/default', { injected: true }],
})
});
// vitest.config.ts
defineConfig({
@@ -154,7 +154,7 @@ defineConfig({
},
],
},
})
});
```
## Scoped Values per Suite
@@ -164,19 +164,19 @@ Override fixture for specific suite:
```ts
const test = base.extend({
environment: 'development',
})
});
describe('production tests', () => {
test.scoped({ environment: 'production' })
test.scoped({ environment: 'production' });
test('uses production', ({ environment }) => {
expect(environment).toBe('production')
})
})
expect(environment).toBe('production');
});
});
test('uses default', ({ environment }) => {
expect(environment).toBe('development')
})
expect(environment).toBe('development');
});
```
## Extended Test Hooks
@@ -186,20 +186,20 @@ Type-aware hooks with fixtures:
```ts
const test = base.extend<{ db: Database }>({
db: async ({}, use) => {
const db = await createDb()
await use(db)
await db.close()
const db = await createDb();
await use(db);
await db.close();
},
})
});
// Hooks know about fixtures
test.beforeEach(({ db }) => {
db.seed()
})
db.seed();
});
test.afterEach(({ db }) => {
db.clear()
})
db.clear();
});
```
## Composing Fixtures
@@ -209,18 +209,20 @@ Extend from another extended test:
```ts
// base-test.ts
export const test = base.extend<{ db: Database }>({
db: async ({}, use) => { /* ... */ },
})
db: async ({}, use) => {
/* ... */
},
});
// admin-test.ts
import { test as dbTest } from './base-test'
import { test as dbTest } from './base-test';
export const test = dbTest.extend<{ admin: User }>({
admin: async ({ db }, use) => {
const admin = await db.createAdmin()
await use(admin)
const admin = await db.createAdmin();
await use(admin);
},
})
});
```
## Key Points
@@ -232,7 +234,7 @@ export const test = dbTest.extend<{ admin: User }>({
- Use `{ scope: 'file' }` for expensive shared resources
- Fixtures compose - extend from extended tests
<!--
<!--
Source references:
- https://vitest.dev/guide/test-context.html
-->