mikepenz/release-changelog-builder-action

How to run locally?

JanC opened this issue · 2 comments

JanC commented

hey @mikepenz
thanks for this open source project.

Could you please elaborate how to run the tool locally against my own repo? I tried following the readme but npm test -- custom.test.ts won't work.

❯ npm test -- custom.test.ts
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

> release-changelog-builder-action@v3.0.0 test
> jest "custom.test.ts"

 FAIL  ./custom.test.ts
  ● Test suite failed to run

    custom.test.ts:26:5 - error TS2345: Argument of type 'Configuration | undefined' is not assignable to parameter of type 'Configuration'.
      Type 'undefined' is not assignable to type 'Configuration'.

    26     configuration  // configuration
           ~~~~~~~~~~~~~

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.628 s
Ran all test suites matching /custom.test.ts/i.

@JanC thank you for the report. I think I broke the example in the README with a recent update.

You want to update the following part in the custom.test.ts: https://github.com/mikepenz/release-changelog-builder-action/blob/develop/__tests__/releaseNotesBuilder.test.ts#L7

E.g. change

const configuration = resolveConfiguration(
    '',
    'configs_test/configuration_approvers.json'
  )

to something like this:

 const configuration = mergeConfiguration(undefined, resolveConfiguration('', 'configs_test/configuration_approvers.json')) 

(+ add the imports)

JanC commented

great, thanks!