15db0371da
This pull request fixes the file extension for two test files that were incorrectly named. This caused them not to be tested. A new test has been added to ensure all test files have the correct extension. This also fixes a bug in some tests where `repositories` inputs included the repository owner. The owner has been removed from these inputs and the snapshots have been updated.
30 lines
899 B
JavaScript
30 lines
899 B
JavaScript
import { readdirSync } from "node:fs";
|
||
|
||
import test from "ava";
|
||
import { execa } from "execa";
|
||
|
||
// Get all files in tests directory
|
||
const files = readdirSync("tests");
|
||
|
||
// Files to ignore
|
||
const ignore = ["index.js", "main.js", "README.md", "snapshots"];
|
||
|
||
const testFiles = files.filter((file) => !ignore.includes(file));
|
||
|
||
// Throw an error if there is a file that does not end with test.js in the tests directory
|
||
for (const file of testFiles) {
|
||
if (!file.endsWith(".test.js")) {
|
||
throw new Error(`File ${file} does not end with .test.js`);
|
||
}
|
||
test(file, async (t) => {
|
||
// Override Actions environment variables that change `core`’s behavior
|
||
const env = {
|
||
GITHUB_OUTPUT: undefined,
|
||
GITHUB_STATE: undefined,
|
||
};
|
||
const { stderr, stdout } = await execa("node", [`tests/${file}`], { env });
|
||
t.snapshot(stderr, "stderr");
|
||
t.snapshot(stdout, "stdout");
|
||
});
|
||
}
|