Skip to content

Commit 6b1556b

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, as well as some behavior offered by `@metamask/auto-changelog` is also covered, because it seemed to make sense when thinking about how this action "should" work from a high level.
1 parent 6bf6cbc commit 6b1556b

17 files changed

+5320
-16
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: 2 additions & 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",
@@ -75,6 +76,7 @@
7576
"prettier": "^2.2.1",
7677
"rimraf": "^3.0.2",
7778
"ts-jest": "^26.5.5",
79+
"ts-node": "^10.8.1",
7880
"typescript": "^4.2.4"
7981
},
8082
"lavamoat": {

0 commit comments

Comments
 (0)