Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Code of Conduct

The repository code of conduct lives in
[.github/CODE_OF_CONDUCT.md](.github/CODE_OF_CONDUCT.md).
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Contributing

Repository contribution guidance lives in
[.github/CONTRIBUTING.md](.github/CONTRIBUTING.md).
4 changes: 4 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Security

Repository security and vulnerability reporting guidance lives in
[.github/SECURITY.md](.github/SECURITY.md).
39 changes: 39 additions & 0 deletions test/unit/scripts/repository-standard-docs.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { existsSync, readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';

const repoRoot = fileURLToPath(new URL('../../../', import.meta.url));

function readRepoFile(relativePath: string): string {
return readFileSync(`${repoRoot}${relativePath}`, 'utf8');
}

describe('repository standard docs', () => {
it('keeps root pointers to the canonical GitHub standard docs', () => {
const pointers = [
{
rootPath: 'CODE_OF_CONDUCT.md',
githubPath: '.github/CODE_OF_CONDUCT.md',
heading: 'Code of Conduct',
},
{
rootPath: 'CONTRIBUTING.md',
githubPath: '.github/CONTRIBUTING.md',
heading: 'Contributing',
},
{
rootPath: 'SECURITY.md',
githubPath: '.github/SECURITY.md',
heading: 'Security',
},
];

for (const pointer of pointers) {
expect(existsSync(`${repoRoot}${pointer.rootPath}`)).toBe(true);
expect(existsSync(`${repoRoot}${pointer.githubPath}`)).toBe(true);
const rootPointer = readRepoFile(pointer.rootPath);
expect(rootPointer).toContain(`[${pointer.githubPath}](${pointer.githubPath})`);
expect(rootPointer).toContain(`# ${pointer.heading}\n\n`);
}
});
});
Loading