diff --git a/README.md b/README.md index f0bc7d5..eae74ab 100644 --- a/README.md +++ b/README.md @@ -518,7 +518,7 @@ Regex replace pattern "source": "TITLE", "transformer": { "pattern": "\\s*\\[([A-Z].{2,4}-.{2,5})\\][\\S\\s]*", - "target": ", [$1](https://corp.ticket-system.com/browse/$1)" + "target": "- [$1](https://corp.ticket-system.com/browse/$1)" } } ``` diff --git a/__tests__/configuration.test.ts b/__tests__/configuration.test.ts index 258d509..f1a5426 100644 --- a/__tests__/configuration.test.ts +++ b/__tests__/configuration.test.ts @@ -1,6 +1,8 @@ +import {clear} from '../src/transform' import {mergeConfiguration, parseConfiguration, resolveConfiguration} from '../src/utils' jest.setTimeout(180000) +clear() it('Configurations are merged correctly', async () => { const configurationJson = parseConfiguration(`{ diff --git a/__tests__/gitea/releaseNotesBuilderGitea.test.ts b/__tests__/gitea/releaseNotesBuilderGitea.test.ts index 12c7cc3..a9cd2ab 100644 --- a/__tests__/gitea/releaseNotesBuilderGitea.test.ts +++ b/__tests__/gitea/releaseNotesBuilderGitea.test.ts @@ -1,8 +1,10 @@ import {mergeConfiguration, resolveConfiguration} from '../../src/utils' import {ReleaseNotesBuilder} from '../../src/releaseNotesBuilder' import {GiteaRepository} from '../../src/repositories/GiteaRepository' +import {clear} from '../../src/transform' jest.setTimeout(180000) +clear() /** * Before starting testing, you should manually clone the repository diff --git a/__tests__/gitea/releaseNotesBuilderPullGitea.test.ts b/__tests__/gitea/releaseNotesBuilderPullGitea.test.ts index 567558c..a53bac3 100644 --- a/__tests__/gitea/releaseNotesBuilderPullGitea.test.ts +++ b/__tests__/gitea/releaseNotesBuilderPullGitea.test.ts @@ -2,8 +2,10 @@ import {checkExportedData, mergeConfiguration, resolveConfiguration} from '../.. import {buildChangelog} from '../../src/transform' import {pullData} from '../../src/pr-collector/prCollector' import {GiteaRepository} from '../../src/repositories/GiteaRepository' +import {clear} from '../../src/transform' jest.setTimeout(180000) +clear() // load octokit instance const enablePullData = false diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 7604e11..99d6577 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -2,8 +2,10 @@ import * as path from 'path' import * as process from 'process' import * as cp from 'child_process' import * as fs from 'fs' +import {clear} from '../src/transform' jest.setTimeout(180000) +clear() test('missing values should result in failure', () => { expect.assertions(1) diff --git a/__tests__/regexUtils.test.ts b/__tests__/regexUtils.test.ts index 2cf675c..c21bac7 100644 --- a/__tests__/regexUtils.test.ts +++ b/__tests__/regexUtils.test.ts @@ -1,27 +1,29 @@ -import { transformStringToValue, validateRegex } from '../src/pr-collector/regexUtils' -import { Regex } from '../src/pr-collector/types' +import {transformStringToValue, validateRegex} from '../src/pr-collector/regexUtils' +import {Regex} from '../src/pr-collector/types' +import {clear} from '../src/transform' jest.setTimeout(180000) +clear() it('Replace into target', async () => { const regex: Regex = { pattern: '.*(\\[Feature\\]|\\[Issue\\]).*', - target: '$1', + target: '$1' } const validatedRegex = validateRegex(regex) expect(validateRegex).not.toBeNull() - expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`) + expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`) }) it('Replace all into target', async () => { const regex: Regex = { pattern: '.*(\\[Feature\\]|\\[Issue\\]).*', method: 'replaceAll', - target: '$1', + target: '$1' } const validatedRegex = validateRegex(regex) expect(validateRegex).not.toBeNull() - expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`) + expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`) }) it('Match without target', async () => { @@ -31,27 +33,27 @@ it('Match without target', async () => { } const validatedRegex = validateRegex(regex) expect(validateRegex).not.toBeNull() - expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`) + expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`) }) it('Match into target', async () => { const regex: Regex = { pattern: '(?