Skip to content

Commit

Permalink
fix(reporters): MODULE_NOT_FOUND when working directory not script di…
Browse files Browse the repository at this point in the history
…rectory

Fixes #368
  • Loading branch information
tcort committed Nov 5, 2024
1 parent c1ca441 commit c801280
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## Version 3.13.1

- fix: MODULE_NOT_FOUND error #368

## Version 3.13.0

- feat: anchor link checks support HTML tags like `<a name="foo"></a>` #331 @dklimpel
Expand Down
5 changes: 3 additions & 2 deletions markdown-link-check
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const pkg = require('./package.json');
const { Command } = require('commander');
const program = new Command();
const { ProxyAgent } = require('proxy-agent');
const reporters = require('./reporters');

class Input {
constructor(filenameForOutput, stream, opts) {
Expand Down Expand Up @@ -48,7 +49,7 @@ function loadAllMarkdownFiles(rootFolder = '.') {
}

function commaSeparatedReportersList(value) {
return value.split(',').map((reporter) => require(path.resolve('reporters', reporter)));
return value.split(',').map((reporter) => reporters[reporter] ?? reporters.eefault);
}

function getInputs() {
Expand Down Expand Up @@ -151,7 +152,7 @@ function getInputs() {
input.opts.verbose = (program.opts().verbose === true);
input.opts.retryOn429 = (program.opts().retry === true);
input.opts.aliveStatusCodes = program.opts().alive;
input.opts.reporters = program.opts().reporters ?? [require(path.resolve('reporters', 'default.js'))];
input.opts.reporters = program.opts().reporters ?? [ reporters.default ];
const config = program.opts().config;
if (config) {
input.opts.config = config.trim();
Expand Down
6 changes: 6 additions & 0 deletions reporters/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

module.exports = {
default: require('./default'),
junit: require('./junit'),
};

0 comments on commit c801280

Please sign in to comment.