|
2 | 2 | const path = require("path") |
3 | 3 | const git = require("simple-git")(path.join(__dirname, "..")) |
4 | 4 |
|
5 | | -//Check generated files editions |
| 5 | +//Edited files list |
6 | 6 | const diff = async () => (await git.diff("origin/master...", ["--name-status"])).split("\n").map(x => x.trim()).filter(x => /^M\s+/.test(x)).map(x => x.replace(/^M\s+/, "")) |
7 | | - describe('Auto-generated files were not modified (use "git checkout @ -- file" if needed)', () => void test.each([ |
8 | | - "README.md", |
9 | | - "source/plugins/README.md", |
10 | | - "source/templates/README.md", |
11 | | - "action.yml", |
12 | | - "settings.example.json" |
13 | | - ])("%s", async file => expect((await diff()).includes(file)).toBe(false))) |
| 7 | + |
| 8 | +//Files editions |
| 9 | + describe("Check files editions (checkout your files if needed)", () => { |
| 10 | + describe("Auto-generated files were not modified", () => void test.each([ |
| 11 | + "README.md", |
| 12 | + "source/plugins/README.md", |
| 13 | + "source/templates/README.md", |
| 14 | + "action.yml", |
| 15 | + "settings.example.json" |
| 16 | + ])("%s", async file => expect((await diff()).includes(file)).toBe(false))) |
| 17 | + describe("Repository level files were not modified", () => void test.each([ |
| 18 | + ".github/config/*", |
| 19 | + ".github/ISSUE_TEMPLATE/*", |
| 20 | + ".github/PULL_REQUEST_TEMPLATE/*", |
| 21 | + ".github/readme/README.md", |
| 22 | + ".github/readme/partials/*", |
| 23 | + ".github/workflows/*", |
| 24 | + ".github/FUNDING.yml", |
| 25 | + ".github/index.mjs", |
| 26 | + ".github/release.mjs", |
| 27 | + "LICENSE", |
| 28 | + "SECURITY.md", |
| 29 | + "tests/ci.test.js" |
| 30 | + ])("%s", async file => expect((await diff()).filter(edited => new RegExp(`^${file.replace(/[.]/g, "[.]").replace(/[*]/g, "[\\s\\S]*")}$`).test(edited)).length).toBe(0))) |
| 31 | + }) |
| 32 | + |
| 33 | +//Templates editions |
| 34 | + describe("Check templates editions", () => { |
| 35 | + test("Use community templates instead (see https://github.com/lowlighter/metrics/tree/master/source/templates/community)", async () => void expect((await diff()).filter(edited => /^source[/]templates[/](?:classic|terminal|repository|community)[/][\s\S]*$/.test(edited)).length).toBe(0)) |
| 36 | + }) |
0 commit comments