- attempt to fix esm tests

This commit is contained in:
Mike Penz
2024-12-14 12:25:29 +01:00
parent 30758be82d
commit fe815a18f2
7 changed files with 23 additions and 38 deletions
Generated Vendored
+6 -9
View File
@@ -44504,7 +44504,7 @@ function checkExportedData(exportCache, cacheInput) {
}
}
function resolveMode(mode, commitMode) {
if (commitMode === true) {
if (commitMode) {
return 'COMMIT';
}
if (mode !== undefined) {
@@ -44565,11 +44565,11 @@ function readConfiguration(filename) {
function parseConfiguration(config) {
try {
// for compatibility with the `yml` file we require to use `#{{}}` instead of `${{}}` - replace it here.
const configurationJSON = JSON.parse(config.replace(/\${{/g, '#{{'));
return configurationJSON;
return JSON.parse(config.replace(/\${{/g, '#{{'));
}
catch (error) {
core.info(`⚠️ Configuration provided, but it couldn't be parsed. Fallback to Defaults.`);
core.debug(`Error parsing configuration: ${error}`);
return undefined;
}
}
@@ -45439,13 +45439,12 @@ function buildPrStringsAndFillCategoryEntries(prInfoMap, ignoredLabels, categori
categorizedPrs.push(body);
}
}
const prStrings = {
return {
categorizedList: categorizedPrs,
uncategorizedList: uncategorizedPrs,
openList: openPrs,
ignoredList: ignoredPrs
};
return prStrings;
}
function buildChangelogStrings(flatCategories, prStrings) {
const { categorizedList, uncategorizedList, openList, ignoredList } = prStrings;
@@ -45488,13 +45487,12 @@ function buildChangelogStrings(flatCategories, prStrings) {
core.debug(` ${pr}`);
}
}
const changelogStrings = {
return {
categorized: changelogCategorized,
uncategorized: changelogUncategorized,
open: changelogOpen,
ignored: changelogIgnored
};
return changelogStrings;
}
function buildReleaseNotesTemplateContext(changelogStrings, contributorsString, externalContributorString, prStrings, diffInfo, options) {
const { categorized: changelogCategorized, uncategorized: changelogUncategorized, open: changelogOpen, ignored: changelogIgnored } = changelogStrings;
@@ -45622,8 +45620,7 @@ function renderEmptyChangelogTemplate(template, options) {
createOrSet(placeholders, ph.source, ph);
}
const releaseNotesTemplateContext = buildCoreReleaseNotesTemplateContext(options);
const renderedEmptyChangelogTemplate = renderTemplateAndFillPlaceholderContext(template, releaseNotesTemplateContext, placeholders, undefined, options.configuration);
return renderedEmptyChangelogTemplate;
return renderTemplateAndFillPlaceholderContext(template, releaseNotesTemplateContext, placeholders, undefined, options.configuration);
}
function buildCoreReleaseNotesTemplateContext(options) {
const templateContext = new TemplateContext();
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -19,7 +19,7 @@ export default [{
ignores: ["**/dist/", "**/lib/", "**/node_modules/"]
}, ...compat.extends("plugin:github/recommended"), {
files: ["src/*.ts", "src/**/*.ts", "__tests__/**/*.ts", "__tests__/*.ts"],
files: ["src/**.ts", "__tests__/**.ts"],
plugins: {
jest,
+6 -6
View File
@@ -1,12 +1,12 @@
// jest.config.js
import { createJsWithTsEsmPreset } from "ts-jest";
export default {
clearMocks: true,
moduleFileExtensions: ["js", "ts"],
moduleDirectories: ["src", "node_modules"],
testEnvironment: "node",
testMatch: ["**/*.test.ts"],
testRunner: "jest-circus/runner",
transform: {
'^.+\\.ts$': 'ts-jest'
moduleNameMapper: {
"(.+)\\.js": "$1",
},
verbose: true
};
...createJsWithTsEsmPreset(),
}
+3 -3
View File
@@ -7,9 +7,9 @@
"type": "module",
"scripts": {
"build": "tsc",
"format": "prettier --write **/*.ts **/**/*.ts",
"format-check": "prettier --check **/*.ts",
"format-fix": "eslint --fix src/**/*.ts",
"format": "prettier --write src/**.ts",
"format-check": "prettier --check src/**.ts",
"format-fix": "eslint --fix src/**.ts",
"lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt",
"test": "jest",
+3 -15
View File
@@ -315,14 +315,12 @@ function buildPrStringsAndFillCategoryEntries(
}
}
const prStrings: PrStrings = {
return {
categorizedList: categorizedPrs,
uncategorizedList: uncategorizedPrs,
openList: openPrs,
ignoredList: ignoredPrs
}
return prStrings
}
function buildChangelogStrings(flatCategories: Category[], prStrings: PrStrings): ChangelogStrings {
@@ -371,14 +369,12 @@ function buildChangelogStrings(flatCategories: Category[], prStrings: PrStrings)
}
}
const changelogStrings: ChangelogStrings = {
return {
categorized: changelogCategorized,
uncategorized: changelogUncategorized,
open: changelogOpen,
ignored: changelogIgnored
}
return changelogStrings
}
function buildReleaseNotesTemplateContext(
@@ -550,15 +546,7 @@ export function renderEmptyChangelogTemplate(template: string, options: ReleaseN
const releaseNotesTemplateContext = buildCoreReleaseNotesTemplateContext(options)
const renderedEmptyChangelogTemplate = renderTemplateAndFillPlaceholderContext(
template,
releaseNotesTemplateContext,
placeholders,
undefined,
options.configuration
)
return renderedEmptyChangelogTemplate
return renderTemplateAndFillPlaceholderContext(template, releaseNotesTemplateContext, placeholders, undefined, options.configuration)
}
function buildCoreReleaseNotesTemplateContext(options: ReleaseNotesOptions): TemplateContext {
+3 -3
View File
@@ -118,7 +118,7 @@ export function checkExportedData(exportCache: boolean, cacheInput: string | nul
}
export function resolveMode(mode: string | undefined, commitMode: boolean): 'PR' | 'COMMIT' | 'HYBRID' {
if (commitMode === true) {
if (commitMode) {
return 'COMMIT'
}
@@ -179,10 +179,10 @@ function readConfiguration(filename: string): Configuration | undefined {
export function parseConfiguration(config: string): Configuration | undefined {
try {
// for compatibility with the `yml` file we require to use `#{{}}` instead of `${{}}` - replace it here.
const configurationJSON: Configuration = JSON.parse(config.replace(/\${{/g, '#{{'))
return configurationJSON
return JSON.parse(config.replace(/\${{/g, '#{{'))
} catch (error) {
core.info(`⚠️ Configuration provided, but it couldn't be parsed. Fallback to Defaults.`)
core.debug(`Error parsing configuration: ${error}`)
return undefined
}
}