Merge pull request #1426 from mikepenz/feature/upgrade_dependencies_jest_fix

Upgrade remaining dependency | Fix jest setup
This commit is contained in:
Mike Penz
2025-01-31 19:41:54 +01:00
committed by GitHub
18 changed files with 4875 additions and 3753 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import {mergeConfiguration, parseConfiguration, resolveConfiguration} from '../src/utils.js' import {mergeConfiguration, parseConfiguration, resolveConfiguration} from '../src/utils.js'
import { clear } from "../src/transform.js"; import {clear} from '../src/transform.js'
import {jest} from '@jest/globals'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+1
View File
@@ -1,6 +1,7 @@
import {mergeConfiguration, resolveConfiguration} from '../../src/utils.js' import {mergeConfiguration, resolveConfiguration} from '../../src/utils.js'
import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder.js' import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder.js'
import {GithubRepository} from '../../src/repositories/GithubRepository.js' import {GithubRepository} from '../../src/repositories/GithubRepository.js'
import {jest} from '@jest/globals'
jest.setTimeout(180000) jest.setTimeout(180000)
@@ -2,6 +2,7 @@ import {mergeConfiguration, resolveConfiguration} from '../../src/utils.js'
import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder.js' import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder.js'
import {GiteaRepository} from '../../src/repositories/GiteaRepository.js' import {GiteaRepository} from '../../src/repositories/GiteaRepository.js'
import {clear} from '../../src/transform.js' import {clear} from '../../src/transform.js'
import {jest} from '@jest/globals'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
@@ -4,6 +4,7 @@ import {Options, pullData} from '../../src/pr-collector/prCollector.js'
import {GiteaRepository} from '../../src/repositories/GiteaRepository.js' import {GiteaRepository} from '../../src/repositories/GiteaRepository.js'
import {clear} from '../../src/transform.js' import {clear} from '../../src/transform.js'
import {ReleaseNotesOptions} from '../../src/releaseNotesBuilder.js' import {ReleaseNotesOptions} from '../../src/releaseNotesBuilder.js'
import {jest} from '@jest/globals'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+5
View File
@@ -3,10 +3,15 @@ import * as process from 'process'
import * as cp from 'child_process' import * as cp from 'child_process'
import * as fs from 'fs' import * as fs from 'fs'
import {clear} from '../src/transform.js' import {clear} from '../src/transform.js'
import {jest} from '@jest/globals'
import { fileURLToPath } from 'url';
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory
test('missing values should result in failure', () => { test('missing values should result in failure', () => {
expect.assertions(1) expect.assertions(1)
+1
View File
@@ -1,6 +1,7 @@
import {transformStringToValue, validateRegex} from '../src/pr-collector/regexUtils.js' import {transformStringToValue, validateRegex} from '../src/pr-collector/regexUtils.js'
import {Regex} from '../src/pr-collector/types.js' import {Regex} from '../src/pr-collector/types.js'
import {clear} from '../src/transform.js' import {clear} from '../src/transform.js'
import {jest} from '@jest/globals'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+1
View File
@@ -2,6 +2,7 @@ import {mergeConfiguration, resolveConfiguration} from '../src/utils.js'
import {ReleaseNotesBuilder} from '../src/releaseNotesBuilder.js' import {ReleaseNotesBuilder} from '../src/releaseNotesBuilder.js'
import {GithubRepository} from '../src/repositories/GithubRepository.js' import {GithubRepository} from '../src/repositories/GithubRepository.js'
import {clear} from '../src/transform.js' import {clear} from '../src/transform.js'
import {jest} from '@jest/globals'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
@@ -4,6 +4,7 @@ import {Options, pullData} from '../src/pr-collector/prCollector.js'
import {GithubRepository} from '../src/repositories/GithubRepository.js' import {GithubRepository} from '../src/repositories/GithubRepository.js'
import {clear} from '../src/transform.js' import {clear} from '../src/transform.js'
import {ReleaseNotesOptions} from '../src/releaseNotesBuilder.js' import {ReleaseNotesOptions} from '../src/releaseNotesBuilder.js'
import {jest} from '@jest/globals'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+1
View File
@@ -2,6 +2,7 @@ import {TagResolver} from '../src/configuration.js'
import {validateRegex} from '../src/pr-collector/regexUtils.js' import {validateRegex} from '../src/pr-collector/regexUtils.js'
import {filterTags, prepareAndSortTags, TagInfo, transformTags} from '../src/pr-collector/tags.js' import {filterTags, prepareAndSortTags, TagInfo, transformTags} from '../src/pr-collector/tags.js'
import {clear} from '../src/transform.js' import {clear} from '../src/transform.js'
import {jest} from '@jest/globals'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+20 -2
View File
@@ -1,15 +1,33 @@
import {buildChangelog} from '../src/transform.js' import {buildChangelog} from '../src/transform.js'
import moment from 'moment' import moment from 'moment'
import {DefaultConfiguration} from '../src/configuration.js' import {Configuration, DefaultConfiguration} from '../src/configuration.js'
import {PullRequestInfo} from '../src/pr-collector/pullRequests.js' import {PullRequestInfo} from '../src/pr-collector/pullRequests.js'
import {DefaultDiffInfo} from '../src/pr-collector/commits.js' import {DefaultDiffInfo} from '../src/pr-collector/commits.js'
import {GithubRepository} from '../src/repositories/GithubRepository.js' import {GithubRepository} from '../src/repositories/GithubRepository.js'
import {clear} from '../src/transform.js' import {clear} from '../src/transform.js'
import { buildChangelogTest } from "./utils.js"; import {jest} from '@jest/globals'
import {BaseRepository} from '../src/repositories/BaseRepository.js'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
const buildChangelogTest = (config: Configuration, prs: PullRequestInfo[], repositoryUtils: BaseRepository): string => {
return buildChangelog(DefaultDiffInfo, prs, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
fetchReleaseInformation: false,
fetchReviews: false,
mode: 'PR',
configuration: config,
repositoryUtils
})
}
const configuration = Object.assign({}, DefaultConfiguration) const configuration = Object.assign({}, DefaultConfiguration)
configuration.categories = [ configuration.categories = [
{ {
+42 -3
View File
@@ -1,15 +1,54 @@
import moment from 'moment' import moment from 'moment'
import {DefaultConfiguration} from '../src/configuration.js' import {Configuration, DefaultConfiguration} from '../src/configuration.js'
import {PullRequestInfo} from '../src/pr-collector/pullRequests.js' import {PullRequestInfo} from '../src/pr-collector/pullRequests.js'
import {GithubRepository} from '../src/repositories/GithubRepository.js' import {GithubRepository} from '../src/repositories/GithubRepository.js'
import {clear} from '../src/transform.js' import {buildChangelog, clear} from '../src/transform.js'
import {buildChangelogTest, buildPullRequeset} from './utils.js' import {jest} from '@jest/globals'
import {BaseRepository} from '../src/repositories/BaseRepository.js'
import {DefaultDiffInfo} from '../src/pr-collector/commits.js'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
const repositoryUtils = new GithubRepository(process.env.GITEA_TOKEN || '', undefined, '.') const repositoryUtils = new GithubRepository(process.env.GITEA_TOKEN || '', undefined, '.')
const buildChangelogTest = (config: Configuration, prs: PullRequestInfo[], repositoryUtils: BaseRepository): string => {
return buildChangelog(DefaultDiffInfo, prs, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
fetchReleaseInformation: false,
fetchReviews: false,
mode: 'PR',
configuration: config,
repositoryUtils
})
}
const buildPullRequeset = (number: number, title: string, labels: string[] = ['feature']): PullRequestInfo => {
return {
number,
title,
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment(),
mergeCommitSha: 'sha',
author: 'Author',
authorName: 'Author',
repoName: 'test-repo',
labels,
milestone: '',
body: '',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: 'merged'
}
}
// test set of PRs with lables predefined // test set of PRs with lables predefined
const pullRequestsWithLabels: PullRequestInfo[] = [] const pullRequestsWithLabels: PullRequestInfo[] = []
pullRequestsWithLabels.push( pullRequestsWithLabels.push(
-45
View File
@@ -1,45 +0,0 @@
import {Configuration} from '../src/configuration.js'
import {DefaultDiffInfo} from '../src/pr-collector/commits.js'
import {PullRequestInfo} from '../src/pr-collector/pullRequests.js'
import {buildChangelog} from '../src/transform.js'
import {BaseRepository} from '../src/repositories/BaseRepository.js'
import moment from 'moment'
export const buildChangelogTest = (config: Configuration, prs: PullRequestInfo[], repositoryUtils: BaseRepository): string => {
return buildChangelog(DefaultDiffInfo, prs, {
owner: 'mikepenz',
repo: 'test-repo',
fromTag: {name: '1.0.0'},
toTag: {name: '2.0.0'},
includeOpen: false,
failOnError: false,
fetchReviewers: false,
fetchReleaseInformation: false,
fetchReviews: false,
mode: 'PR',
configuration: config,
repositoryUtils
})
}
export const buildPullRequeset = (number: number, title: string, labels: string[] = ['feature']): PullRequestInfo => {
return {
number,
title,
htmlURL: '',
baseBranch: '',
createdAt: moment(),
mergedAt: moment(),
mergeCommitSha: 'sha',
author: 'Author',
authorName: 'Author',
repoName: 'test-repo',
labels,
milestone: '',
body: '',
assignees: [],
requestedReviewers: [],
approvedReviewers: [],
status: 'merged'
}
}
Generated Vendored
+3918 -2653
View File
File diff suppressed because it is too large Load Diff
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+27
View File
@@ -575,6 +575,33 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
fast-content-type-parse
MIT
MIT License
Copyright (c) 2023 The Fastify Team
The Fastify team members are listed at https://github.com/fastify/fastify#team
and in the README file.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
gitea-js gitea-js
MIT MIT
MIT License MIT License
+7 -7
View File
@@ -1,12 +1,12 @@
// jest.config.js // jest.config.js
import { createJsWithTsEsmPreset } from "ts-jest";
import { createDefaultEsmPreset } from "ts-jest";
export default { export default {
clearMocks: true,
testEnvironment: "node", testEnvironment: "node",
testMatch: ["**/*.test.ts"], extensionsToTreatAsEsm: [".ts"],
testRunner: "jest-circus/runner",
moduleNameMapper: { moduleNameMapper: {
"(.+)\\.js": "$1", "(.+)\\.js": "$1"
}, },
...createJsWithTsEsmPreset(), ...createDefaultEsmPreset()
} };
+836 -1030
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -12,10 +12,10 @@
"format-fix": "eslint --fix src/**.ts", "format-fix": "eslint --fix src/**.ts",
"lint": "eslint src/**/*.ts", "lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt", "package": "ncc build --source-map --license licenses.txt",
"test": "jest", "test": "NODE_OPTIONS=--experimental-vm-modules jest",
"test-github": "jest __tests__/*.test.ts", "test-github": "NODE_OPTIONS=--experimental-vm-modules jest __tests__/*.test.ts",
"test-gitea": "jest __tests__/gitea/*.test.ts", "test-gitea": "NODE_OPTIONS=--experimental-vm-modules jest __tests__/gitea/*.test.ts",
"test-demo": "jest __tests__/demo/*.test.ts", "test-demo": "NODE_OPTIONS=--experimental-vm-modules jest __tests__/demo/*.test.ts",
"all": "npm run build && npm run format && npm run lint && npm run package && npm run test-github" "all": "npm run build && npm run format && npm run lint && npm run package && npm run test-github"
}, },
"repository": { "repository": {
@@ -40,22 +40,22 @@
"@actions/core": "^1.11.1", "@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"@octokit/rest": "^20.1.1", "@octokit/rest": "^21.1.0",
"gitea-js": "^1.23.0", "gitea-js": "^1.23.0",
"globals": "^15.14.0", "globals": "^15.14.0",
"https-proxy-agent": "^7.0.6", "https-proxy-agent": "^7.0.6",
"moment": "^2.30.1", "moment": "^2.30.1",
"semver": "^7.6.3" "semver": "^7.7.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/node": "^22.10.10", "@types/node": "^22.12.0",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^8.21.0", "@typescript-eslint/eslint-plugin": "^8.22.0",
"@typescript-eslint/parser": "^8.21.0", "@typescript-eslint/parser": "^8.22.0",
"@vercel/ncc": "^0.38.3", "@vercel/ncc": "^0.38.3",
"eslint": "^9.19.0", "eslint": "^9.19.0",
"eslint-plugin-github": "^5.1.5", "eslint-plugin-github": "^5.1.7",
"eslint-plugin-import": "^2.31.0", "eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.11.0", "eslint-plugin-jest": "^28.11.0",
"eslint-plugin-prettier": "^5.2.3", "eslint-plugin-prettier": "^5.2.3",