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