Skip to content

Commit 16cb8b6

Browse files
committed
Add high-level tests
This commit adds tests which exercise the behavior of the script that powers the majority of this action. It does this by using real Git repos and testing the contents of real files instead of mocking out commands and access to the filesystem. The tests in this commit should cover all of the happy paths provided directly by this action. In addition, some of the behavior provided by `@metamask/auto-changelog` is also covered, because it seemed to make sense. Some failure cases are also covered as well — this was done for exploratory reasons, and an argument could be made that we don't need these sort of tests right now.
1 parent d0ab412 commit 16cb8b6

File tree

10 files changed

+5784
-15
lines changed

10 files changed

+5784
-15
lines changed

dist/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12258,7 +12258,8 @@ var InputNames;
1225812258
InputNames["ReleaseType"] = "release-type";
1225912259
InputNames["ReleaseVersion"] = "release-version";
1226012260
})(InputNames || (InputNames = {}));
12261-
const WORKSPACE_ROOT = process.env.GITHUB_WORKSPACE;
12261+
const env = process.env;
12262+
const WORKSPACE_ROOT = env.GITHUB_WORKSPACE;
1226212263
/**
1226312264
* Validates and returns the inputs to the Action.
1226412265
* We perform additional validation because the GitHub Actions configuration
@@ -12283,7 +12284,7 @@ function getActionInputs() {
1228312284
*/
1228412285
function getProcessEnvValue(key) {
1228512286
var _a;
12286-
return ((_a = process.env[key]) === null || _a === void 0 ? void 0 : _a.trim()) || '';
12287+
return ((_a = env[key]) === null || _a === void 0 ? void 0 : _a.trim()) || '';
1228712288
}
1228812289
/**
1228912290
* Validates the inputs to the Action, defined earlier in this file.

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ module.exports = {
2121
restoreMocks: true,
2222
testEnvironment: 'node',
2323
testRegex: ['\\.test\\.(ts|js)$'],
24-
testTimeout: 2500,
24+
testTimeout: 5000,
2525
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"@typescript-eslint/eslint-plugin": "^4.22.0",
6565
"@typescript-eslint/parser": "^4.22.0",
6666
"@vercel/ncc": "^0.28.3",
67+
"deepmerge": "^4.2.2",
6768
"eslint": "^7.24.0",
6869
"eslint-config-prettier": "^8.2.0",
6970
"eslint-plugin-import": "^2.22.1",

0 commit comments

Comments
 (0)