- format code

This commit is contained in:
Mike Penz
2024-03-01 19:24:09 +00:00
committed by GitHub
parent 39d8ac4b4f
commit 4014bc63c1
9 changed files with 26 additions and 27 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import { clear } from '../src/transform' import {clear} from '../src/transform'
import {mergeConfiguration, parseConfiguration, resolveConfiguration} from '../src/utils' import {mergeConfiguration, parseConfiguration, resolveConfiguration} from '../src/utils'
jest.setTimeout(180000) jest.setTimeout(180000)
@@ -1,7 +1,7 @@
import {mergeConfiguration, resolveConfiguration} from '../../src/utils' import {mergeConfiguration, resolveConfiguration} from '../../src/utils'
import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder' import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder'
import {GiteaRepository} from '../../src/repositories/GiteaRepository' import {GiteaRepository} from '../../src/repositories/GiteaRepository'
import { clear } from '../../src/transform' import {clear} from '../../src/transform'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
@@ -2,7 +2,7 @@ import {checkExportedData, mergeConfiguration, resolveConfiguration} from '../..
import {buildChangelog} from '../../src/transform' import {buildChangelog} from '../../src/transform'
import {pullData} from '../../src/pr-collector/prCollector' import {pullData} from '../../src/pr-collector/prCollector'
import {GiteaRepository} from '../../src/repositories/GiteaRepository' import {GiteaRepository} from '../../src/repositories/GiteaRepository'
import { clear } from '../../src/transform' import {clear} from '../../src/transform'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+1 -1
View File
@@ -2,7 +2,7 @@ import * as path from 'path'
import * as process from 'process' 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' import {clear} from '../src/transform'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+13 -13
View File
@@ -1,6 +1,6 @@
import { transformStringToValue, validateRegex } from '../src/pr-collector/regexUtils' import {transformStringToValue, validateRegex} from '../src/pr-collector/regexUtils'
import { Regex } from '../src/pr-collector/types' import {Regex} from '../src/pr-collector/types'
import { clear } from '../src/transform' import {clear} from '../src/transform'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
@@ -8,22 +8,22 @@ clear()
it('Replace into target', async () => { it('Replace into target', async () => {
const regex: Regex = { const regex: Regex = {
pattern: '.*(\\[Feature\\]|\\[Issue\\]).*', pattern: '.*(\\[Feature\\]|\\[Issue\\]).*',
target: '$1', target: '$1'
} }
const validatedRegex = validateRegex(regex) const validatedRegex = validateRegex(regex)
expect(validateRegex).not.toBeNull() expect(validateRegex).not.toBeNull()
expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`) expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`)
}) })
it('Replace all into target', async () => { it('Replace all into target', async () => {
const regex: Regex = { const regex: Regex = {
pattern: '.*(\\[Feature\\]|\\[Issue\\]).*', pattern: '.*(\\[Feature\\]|\\[Issue\\]).*',
method: 'replaceAll', method: 'replaceAll',
target: '$1', target: '$1'
} }
const validatedRegex = validateRegex(regex) const validatedRegex = validateRegex(regex)
expect(validateRegex).not.toBeNull() expect(validateRegex).not.toBeNull()
expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`) expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`)
}) })
it('Match without target', async () => { it('Match without target', async () => {
@@ -33,27 +33,27 @@ it('Match without target', async () => {
} }
const validatedRegex = validateRegex(regex) const validatedRegex = validateRegex(regex)
expect(validateRegex).not.toBeNull() expect(validateRegex).not.toBeNull()
expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`) expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`)
}) })
it('Match into target', async () => { it('Match into target', async () => {
const regex: Regex = { const regex: Regex = {
pattern: '(?<label>\\[Feature\\]|\\[Issue\\])', pattern: '(?<label>\\[Feature\\]|\\[Issue\\])',
method: 'match', method: 'match',
target: '$1', target: '$1'
} }
const validatedRegex = validateRegex(regex) const validatedRegex = validateRegex(regex)
expect(validateRegex).not.toBeNull() expect(validateRegex).not.toBeNull()
expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`) expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`)
}) })
it('Match into named group', async () => { it('Match into named group', async () => {
const regex: Regex = { const regex: Regex = {
pattern: '(?<label>\\[Feature\\]|\\[Issue\\])', pattern: '(?<label>\\[Feature\\]|\\[Issue\\])',
method: 'match', method: 'match',
target: 'label', target: 'label'
} }
const validatedRegex = validateRegex(regex) const validatedRegex = validateRegex(regex)
expect(validateRegex).not.toBeNull() expect(validateRegex).not.toBeNull()
expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`) expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`)
}) })
+1 -1
View File
@@ -1,7 +1,7 @@
import {mergeConfiguration, resolveConfiguration} from '../src/utils' import {mergeConfiguration, resolveConfiguration} from '../src/utils'
import {ReleaseNotesBuilder} from '../src/releaseNotesBuilder' import {ReleaseNotesBuilder} from '../src/releaseNotesBuilder'
import {GithubRepository} from '../src/repositories/GithubRepository' import {GithubRepository} from '../src/repositories/GithubRepository'
import { clear } from '../src/transform' import {clear} from '../src/transform'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+1 -1
View File
@@ -2,7 +2,7 @@ import {checkExportedData, mergeConfiguration, resolveConfiguration} from '../sr
import {buildChangelog} from '../src/transform' import {buildChangelog} from '../src/transform'
import {pullData} from '../src/pr-collector/prCollector' import {pullData} from '../src/pr-collector/prCollector'
import {GithubRepository} from '../src/repositories/GithubRepository' import {GithubRepository} from '../src/repositories/GithubRepository'
import { clear } from '../src/transform' import {clear} from '../src/transform'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
+6 -7
View File
@@ -1,7 +1,7 @@
import { TagResolver } from '../src/configuration' import {TagResolver} from '../src/configuration'
import { validateRegex } from '../src/pr-collector/regexUtils' import {validateRegex} from '../src/pr-collector/regexUtils'
import {filterTags, prepareAndSortTags, TagInfo, transformTags} from '../src/pr-collector/tags' import {filterTags, prepareAndSortTags, TagInfo, transformTags} from '../src/pr-collector/tags'
import { clear } from '../src/transform' import {clear} from '../src/transform'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()
@@ -154,7 +154,6 @@ it('Should filter tags correctly using the regex (inverse)', async () => {
expect(filtered).toStrictEqual(`0.1.0-b01,1.0.0,1.0.0-a01,2.0.0,10.1.0,20.0.2`) expect(filtered).toStrictEqual(`0.1.0-b01,1.0.0,1.0.0-a01,2.0.0,10.1.0,20.0.2`)
}) })
it('Should transform tags correctly using the regex', async () => { it('Should transform tags correctly using the regex', async () => {
const tags: TagInfo[] = [ const tags: TagInfo[] = [
{name: 'api-0.0.1', commit: ''}, {name: 'api-0.0.1', commit: ''},
@@ -170,13 +169,13 @@ it('Should transform tags correctly using the regex', async () => {
const tagResolver: TagResolver = { const tagResolver: TagResolver = {
method: 'non-existing-method', method: 'non-existing-method',
transformer: { transformer: {
pattern: '(api\-)?(.+)', pattern: '(api-)?(.+)',
target: "$2" target: '$2'
} }
} }
const transformer = validateRegex(tagResolver.transformer) const transformer = validateRegex(tagResolver.transformer)
if(transformer != null) { if (transformer != null) {
const transformed = transformTags(tags, transformer) const transformed = transformTags(tags, transformer)
.map(function (tag) { .map(function (tag) {
return tag.name return tag.name
+1 -1
View File
@@ -4,7 +4,7 @@ import {Configuration, DefaultConfiguration} from '../src/configuration'
import {PullRequestInfo} from '../src/pr-collector/pullRequests' import {PullRequestInfo} from '../src/pr-collector/pullRequests'
import {DefaultDiffInfo} from '../src/pr-collector/commits' import {DefaultDiffInfo} from '../src/pr-collector/commits'
import {GithubRepository} from '../src/repositories/GithubRepository' import {GithubRepository} from '../src/repositories/GithubRepository'
import { clear } from '../src/transform' import {clear} from '../src/transform'
jest.setTimeout(180000) jest.setTimeout(180000)
clear() clear()