Skip to content

Commit

Permalink
- attempt to fix esm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepenz committed Dec 14, 2024
1 parent 30758be commit fe815a1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 38 deletions.
15 changes: 6 additions & 9 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -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(),
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 3 additions & 15 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit fe815a1

Please sign in to comment.