diff --git a/linter.js b/linter.js index 41da816..462703a 100755 --- a/linter.js +++ b/linter.js @@ -175,6 +175,7 @@ function numberFromLog (logFile, regex, counterror = true) { const printLintResults = function (verbose = false) { const markdownlintLogPath = path.resolve(cwd, markdownLintLog) + const markdownlintLogRelPath = path.relative(cwd, markdownlintLogPath) const markdownFiles = /Linting: (\d+) file/g const files = fs.readdirSync(__dirname).filter(fn => fn.match(markdownLintLog)) const markdownFilesCount = numberFromLog(files[0], markdownFiles, false) @@ -197,8 +198,9 @@ const printLintResults = function (verbose = false) { // Markdown Link Check const markdownLinkCheckErrors = /ERROR: (\d+) dead links found!/g - const markdownlinkcheckLog = path.resolve(cwd, markdownLinkCheckLog) - const markdownlinkCheckErrorsCount = numberFromLog(markdownlinkcheckLog, markdownLinkCheckErrors) + const markdownlinkcheckLogPath = path.resolve(cwd, markdownLinkCheckLog) + const markdownlinkcheckLogRelPath = path.relative(cwd, markdownlinkcheckLogPath) + const markdownlinkCheckErrorsCount = numberFromLog(markdownlinkcheckLogPath, markdownLinkCheckErrors) // Log markdownlint if (markdownLintErrorsCount !== null && markdownLintErrorsCount !== undefined) { @@ -206,7 +208,7 @@ const printLintResults = function (verbose = false) { if (verbose) { printErrorsFile(markdownlintLogPath) } - console.log(`Full markdownlint log see in ${markdownlintLogPath}\n`) + console.log(`Full markdownlint log see in ${markdownlintLogRelPath}\n`) if (markdownlinkCheckErrorsCount !== null && markdownlinkCheckErrorsCount !== undefined) { if (verbose) { console.log(`\n${'='.repeat(80)}\n`) @@ -218,9 +220,9 @@ const printLintResults = function (verbose = false) { if (markdownlinkCheckErrorsCount !== null && markdownlinkCheckErrorsCount !== undefined) { console.log(`Found ${markdownlinkCheckErrorsCount} broken external links`) if (verbose) { - printErrorsFile(markdownlinkcheckLog) + printErrorsFile(markdownlinkcheckLogPath) } - console.log(`Full markdown-link-check log see in ${markdownlinkcheckLog}\n`) + console.log(`Full markdown-link-check log see in ${markdownlinkcheckLogRelPath}\n`) } } @@ -351,7 +353,9 @@ function generateIncludesMap (foliantConfig, debug) { console.error('Error generation includes map:', result.error) } else { spinnerPrepare.stop(true) - console.log(`Subprocess "Foliant" exited with code ${result.status}`) + if (debug) { + console.log(`Subprocess "Foliant" exited with code ${result.status}`) + } } } @@ -431,9 +435,11 @@ function execute (command, verbose = false, debug = false, allowFailure = false, } } } - spinnerLint.stop(true) - console.log(l.join('\n')) - spinnerLint.start() + if (l.length > 0) { + spinnerLint.stop(true) + console.log(l.join('\n')) + spinnerLint.start() + } } function printMarkdownReport (markdownlintResults, counterError) { diff --git a/test/linter-cjs.spec.js b/test/linter-cjs.spec.js index 2d1203f..7d4215d 100644 --- a/test/linter-cjs.spec.js +++ b/test/linter-cjs.spec.js @@ -18,7 +18,7 @@ test('markdown -m slim --format cjs', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 8 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -31,7 +31,7 @@ test('markdown -m slim -l --format cjs', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 8 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.cjs ...')}`] const result = await cli(['markdown', '-m slim', '-l', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(false) @@ -45,7 +45,7 @@ test('markdown -m slim -c --format cjs', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', `-c ${customConfigPath}`, '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -58,7 +58,7 @@ test('markdown -m slim -l -c --format cjs', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.cjs ...')}\n`] const result = await cli(['markdown', '-m slim', '-l', `-c ${customConfigPath}`, '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(false) @@ -84,7 +84,7 @@ test('markdown -m slim -v --format cjs', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', '-v', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -104,7 +104,7 @@ test('markdown -m slim -v -s alt-src --format cjs', async () => { 'alt-src/linter-test-B.md:21 fenced-code-in-quote Fenced code shouldn\'t be in quote\n', 'alt-src/linter-test-B.md:25 validate-internal-links Broken link [image does not exist] [Context: "/red-circle.png"]\n', 'alt-src/linter-test-B.md:29 indented-fence Fenced code shouldn\'t be indented by 1 to 3 spaces [Context: " ```bash"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', '-v', '-s alt-src', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -117,7 +117,7 @@ test('markdown -m slim -v -s no-errors-src -a --format cjs', async () => { const expectedStdout = [ 'Checked 1 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', '-v', '-s no-errors-src', '-a', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -130,7 +130,7 @@ test('markdown -m full --format cjs', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 11 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -143,7 +143,7 @@ test('markdown -m full -l', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 11 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.cjs ...')}`] const result = await cli(['markdown', '-m full', '-l', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(false) @@ -169,7 +169,7 @@ test('markdown -m full -v --format cjs', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-v', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -189,7 +189,7 @@ test('markdown -m full -s alt-src -v --format cjs', async () => { 'alt-src/linter-test-B.md:21 fenced-code-in-quote Fenced code shouldn\'t be in quote\n', 'alt-src/linter-test-B.md:25 validate-internal-links Broken link [image does not exist] [Context: "/red-circle.png"]\n', 'alt-src/linter-test-B.md:29 indented-fence Fenced code shouldn\'t be indented by 1 to 3 spaces [Context: " ```bash"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-s alt-src', '-v', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -206,7 +206,7 @@ test('markdown -m full -s alt-src -v -c --format cjs', asyn 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-s alt-src', '-v', `-c ${customConfigPath}`, '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -223,7 +223,7 @@ test('markdown -m full -s alt-src -v -c -a --format cjs', a 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-s alt-src', '-v', `-c ${customConfigPath}`, '-a', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -236,7 +236,7 @@ test('markdown -m full -s no-errors-src -v -c -a --format c const expectedStdout = [ 'Checked 1 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-s no-errors-src', '-v', `-c ${customConfigPath}`, '-a', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -249,7 +249,7 @@ test('markdown -m full -f --format cjs', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 9 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -262,7 +262,7 @@ test('markdown -m full -f -l --format cjs', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 9 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.cjs ...')}`] const result = await cli(['markdown', '-m full', '-f', '-l', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(false) @@ -288,7 +288,7 @@ test('markdown -m full -f -v --format cjs', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -305,7 +305,7 @@ test('markdown -m full -f -v -c --format cjs', async () => 'FILE: src/linter-test-A.md\n', 'src/linter-test-A.md:8 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'src/linter-test-A.md:10 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v', `-c ${customConfigPath}`, '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -322,7 +322,7 @@ test('markdown -m full -f -v -c -s alt-src --format cjs', a 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v', `-c ${customConfigPath}`, '-s alt-src', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -339,7 +339,7 @@ test('markdown -m full -f -v -c -s alt-src -a --format cjs' 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v', `-c ${customConfigPath}`, '-s alt-src', '-a', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -352,7 +352,7 @@ test('markdown -m full -f -v -c -s no-errors-src -a --forma const expectedStdout = [ 'Checked 1 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v', `-c ${customConfigPath}`, '-s no-errors-src', '-a', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -365,7 +365,7 @@ test('markdown -m typograph --format cjs', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -378,7 +378,7 @@ test('markdown -m typograph -l --format cjs', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.cjs ...')}`] const result = await cli(['markdown', '-m typograph', '-l', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(false) @@ -392,7 +392,7 @@ test('markdown -m typograph -v --format cjs', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -405,7 +405,7 @@ test('markdown -m typograph -v -c --format cjs', async () = const expectedStdout = [ 'Checked 2 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v', `-c ${customConfigPath}`, '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -418,7 +418,7 @@ test('markdown -m typograph -v -c -s alt-src --format cjs', const expectedStdout = [ 'Checked 1 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v', `-c ${customConfigPath}`, '-s alt-src', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -431,7 +431,7 @@ test('markdown -m typograph -v -c -s alt-src -a --format cj const expectedStdout = [ 'Checked 1 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v', `-c ${customConfigPath}`, '-s alt-src', '-a', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) @@ -444,7 +444,7 @@ test('markdown -m typograph -v -c -s no-errors-src -a --for const expectedStdout = [ 'Checked 1 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v', `-c ${customConfigPath}`, '-s no-errors-src', '-a', '--format cjs'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.cjs`)).toBe(true) console.log(result) diff --git a/test/linter-full-check.spec.js b/test/linter-full-check.spec.js index 8420be2..e2e60cb 100644 --- a/test/linter-full-check.spec.js +++ b/test/linter-full-check.spec.js @@ -20,9 +20,9 @@ test('full-check -m slim', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 8 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 2 broken external links\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-m slim'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -35,9 +35,9 @@ test('full-check -m slim -l', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 8 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 2 broken external links\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`, + `Full markdown-link-check log see in .markdownlinkcheck.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.jsonc ...')}`] const result = await cli(['full-check', '-m slim', '-l'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(false) @@ -63,7 +63,7 @@ test('full-check -m slim -v', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 2 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//linter-test-A.md', 'src//subproject/article.md'))}\n`, @@ -71,7 +71,7 @@ test('full-check -m slim -v', async () => { '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//subproject/article.md', 'src//linter-test-A.md'))}\n`, ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-linte', 'https://github.com/holamgadol/foliant-md-lint')} → Status: 404\n`, - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-m slim', '-v'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -96,7 +96,7 @@ test('full-check -m slim -v -p another-project', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 2 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//linter-test-A.md', 'src//subproject/article.md'))}\n`, @@ -104,7 +104,7 @@ test('full-check -m slim -v -p another-project', async () => { '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//subproject/article.md', 'src//linter-test-A.md'))}\n`, ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-linte', 'https://github.com/holamgadol/foliant-md-lint')} → Status: 404\n`, - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-m slim', '-v', '-p another-project'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -124,12 +124,12 @@ test('full-check -m slim -s alt-src -v', async () => { 'alt-src/linter-test-B.md:21 fenced-code-in-quote Fenced code shouldn\'t be in quote\n', 'alt-src/linter-test-B.md:25 validate-internal-links Broken link [image does not exist] [Context: "/red-circle.png"]\n', 'alt-src/linter-test-B.md:29 indented-fence Fenced code shouldn\'t be indented by 1 to 3 spaces [Context: " ```bash"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 1 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-m slim', '-s alt-src', '-v'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -146,12 +146,12 @@ test('full-check -m slim -s alt-src -v -c ', async () => { 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 1 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-m slim', '-s alt-src', '-v', `-c ${customConfigPath}`], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -168,12 +168,12 @@ test('full-check -m slim -s alt-src -v -c -a', async () => 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 1 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-m slim', '-s alt-src', '-v', `-c ${customConfigPath}`, '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -187,7 +187,7 @@ test('full-check -m slim -s no-errors-src -v -c -a', async 'Checked 1 files\n', 'Found 0 formatting errors\n', 'Found 0 broken external links\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-m slim', '-s no-errors-src', '-v', `-c ${customConfigPath}`, '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -200,9 +200,9 @@ test('full-check', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 8 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 2 broken external links\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -226,7 +226,7 @@ test('full-check -v', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 2 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//linter-test-A.md', 'src//subproject/article.md'))}\n`, @@ -234,7 +234,7 @@ test('full-check -v', async () => { '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//subproject/article.md', 'src//linter-test-A.md'))}\n`, ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-linte', 'https://github.com/holamgadol/foliant-md-lint')} → Status: 404\n`, - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-v'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -258,7 +258,7 @@ test('full-check -v -p another-project', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 2 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//linter-test-A.md', 'src//subproject/article.md'))}\n`, @@ -266,7 +266,7 @@ test('full-check -v -p another-project', async () => { '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//subproject/article.md', 'src//linter-test-A.md'))}\n`, ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-linte', 'https://github.com/holamgadol/foliant-md-lint')} → Status: 404\n`, - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-v', '-p another-project'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -285,12 +285,12 @@ test('full-check -s alt-src -v', async () => { 'alt-src/linter-test-B.md:21 fenced-code-in-quote Fenced code shouldn\'t be in quote\n', 'alt-src/linter-test-B.md:25 validate-internal-links Broken link [image does not exist] [Context: "/red-circle.png"]\n', 'alt-src/linter-test-B.md:29 indented-fence Fenced code shouldn\'t be indented by 1 to 3 spaces [Context: " ```bash"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 1 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-s alt-src', '-v'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -306,12 +306,12 @@ test('full-check -s alt-src -v -c ', async () => { 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 1 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-s alt-src', '-v', `-c ${customConfigPath}`], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -328,12 +328,12 @@ test('full-check -s alt-src -v -c -l', async () => { 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 1 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`, + `Full markdown-link-check log see in .markdownlinkcheck.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.jsonc ...')}\n`] const result = await cli(['full-check', '-s alt-src', '-v', `-c ${customConfigPath}`, '-l'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(false) @@ -351,12 +351,12 @@ test('full-check -s alt-src -v -c -a', async () => { 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 1 broken external links\n', '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-s alt-src', '-v', `-c ${customConfigPath}`, '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -369,11 +369,11 @@ test('full-check -s no-errors-src -v -c -a', async () => { const expectedStdout = [ 'Checked 1 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 0 broken external links\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['full-check', '-s no-errors-src', '-v', `-c ${customConfigPath}`, '-a'], '.') console.log(result) diff --git a/test/linter-markdown.spec.js b/test/linter-markdown.spec.js index c2c68c9..2cc6fc9 100644 --- a/test/linter-markdown.spec.js +++ b/test/linter-markdown.spec.js @@ -18,7 +18,7 @@ test('markdown -m slim', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 8 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -31,7 +31,7 @@ test('markdown -m slim -l', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 8 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.jsonc ...')}`] const result = await cli(['markdown', '-m slim', '-l'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(false) @@ -45,7 +45,7 @@ test('markdown -m slim -c ', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', `-c ${customConfigPath}`], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -58,7 +58,7 @@ test('markdown -m slim -l -c ', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.jsonc ...')}\n`] const result = await cli(['markdown', '-m slim', '-l', `-c ${customConfigPath}`], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(false) @@ -84,7 +84,7 @@ test('markdown -m slim -v', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', '-v'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -104,7 +104,7 @@ test('markdown -m slim -v -s alt-src', async () => { 'alt-src/linter-test-B.md:21 fenced-code-in-quote Fenced code shouldn\'t be in quote\n', 'alt-src/linter-test-B.md:25 validate-internal-links Broken link [image does not exist] [Context: "/red-circle.png"]\n', 'alt-src/linter-test-B.md:29 indented-fence Fenced code shouldn\'t be indented by 1 to 3 spaces [Context: " ```bash"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', '-v', '-s alt-src'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -129,7 +129,7 @@ test('markdown -m slim -v -p another-project', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', '-v', '-p another-project'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -154,7 +154,7 @@ test('markdown -m slim -v -p another-project -a', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', '-v', '-p another-project', '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -167,7 +167,7 @@ test('markdown -m slim -v -s no-errors-src -a', async () => { const expectedStdout = [ 'Checked 1 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m slim', '-v', '-s no-errors-src', '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -180,7 +180,7 @@ test('markdown -m full', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 11 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -193,7 +193,7 @@ test('markdown -m full -l', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 11 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.jsonc ...')}`] const result = await cli(['markdown', '-m full', '-l'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(false) @@ -219,7 +219,7 @@ test('markdown -m full -v', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-v'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -244,7 +244,7 @@ test('markdown -m full -v -p another-project', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-v', '-p another-project'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -264,7 +264,7 @@ test('markdown -m full -s alt-src -v', async () => { 'alt-src/linter-test-B.md:21 fenced-code-in-quote Fenced code shouldn\'t be in quote\n', 'alt-src/linter-test-B.md:25 validate-internal-links Broken link [image does not exist] [Context: "/red-circle.png"]\n', 'alt-src/linter-test-B.md:29 indented-fence Fenced code shouldn\'t be indented by 1 to 3 spaces [Context: " ```bash"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-s alt-src', '-v'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -281,7 +281,7 @@ test('markdown -m full -s alt-src -v -c ', async () => { 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-s alt-src', '-v', `-c ${customConfigPath}`], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -298,7 +298,7 @@ test('markdown -m full -s alt-src -v -c -a', async () => { 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-s alt-src', '-v', `-c ${customConfigPath}`, '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -311,7 +311,7 @@ test('markdown -m full -s no-errors-src -v -c -a', async () const expectedStdout = [ 'Checked 1 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-s no-errors-src', '-v', `-c ${customConfigPath}`, '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -324,7 +324,7 @@ test('markdown -m full -f', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 9 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -337,7 +337,7 @@ test('markdown -m full -f -l', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 9 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.jsonc ...')}`] const result = await cli(['markdown', '-m full', '-f', '-l'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(false) @@ -363,7 +363,7 @@ test('markdown -m full -f -v', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -389,7 +389,7 @@ test('markdown -m full -f -v -p another-project', async () => { '--------------------------------------------------------------------------------\n', 'FILE: src/subproject/article.md\n', 'src/subproject/article.md:8 validate-internal-links Broken link [invalid local anchor] [Context: "#anchor"]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v', '-p another-project'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -406,7 +406,7 @@ test('markdown -m full -f -v -c ', async () => { 'FILE: src/linter-test-A.md\n', 'src/linter-test-A.md:8 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'src/linter-test-A.md:10 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v', `-c ${customConfigPath}`], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -423,7 +423,7 @@ test('markdown -m full -f -v -c -s alt-src', async () => { 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v', `-c ${customConfigPath}`, '-s alt-src'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -440,7 +440,7 @@ test('markdown -m full -f -v -c -s alt-src -a', async () => 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v', `-c ${customConfigPath}`, '-s alt-src', '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -453,7 +453,7 @@ test('markdown -m full -f -v -c -s no-errors-src -a', async const expectedStdout = [ 'Checked 1 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m full', '-f', '-v', `-c ${customConfigPath}`, '-s no-errors-src', '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -466,7 +466,7 @@ test('markdown -m typograph', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -479,7 +479,7 @@ test('markdown -m typograph -l', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, `removing ${path.join(cwd, '.markdownlint-cli2.jsonc ...')}`] const result = await cli(['markdown', '-m typograph', '-l'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(false) @@ -493,7 +493,7 @@ test('markdown -m typograph -v', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -506,7 +506,7 @@ test('markdown -m typograph -v -p another-project', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v', '-p another-project'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -519,7 +519,7 @@ test('markdown -m typograph -v -c ', async () => { const expectedStdout = [ 'Checked 2 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v', `-c ${customConfigPath}`], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -532,7 +532,7 @@ test('markdown -m typograph -v -c -s alt-src', async () => const expectedStdout = [ 'Checked 1 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v', `-c ${customConfigPath}`, '-s alt-src'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -545,7 +545,7 @@ test('markdown -m typograph -v -c -s alt-src -a', async () const expectedStdout = [ 'Checked 1 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v', `-c ${customConfigPath}`, '-s alt-src', '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) @@ -558,7 +558,7 @@ test('markdown -m typograph -v -c -s no-errors-src -a', asy const expectedStdout = [ 'Checked 1 files\n', 'Found 0 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`] + `Full markdownlint log see in .markdownlint.log\n`] const result = await cli(['markdown', '-m typograph', '-v', `-c ${customConfigPath}`, '-s no-errors-src', '-a'], '.') expect(fs.existsSync(`${cwd}/.markdownlint-cli2.jsonc`)).toBe(true) console.log(result) diff --git a/test/linter.spec.js b/test/linter.spec.js index 55ebc17..4810355 100644 --- a/test/linter.spec.js +++ b/test/linter.spec.js @@ -145,7 +145,7 @@ test('create-config -m typograph --format cjs', async () => { test('urls', async () => { const expectedStdout = [ 'Found 2 broken external links\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['urls'], '.') console.log(result) @@ -162,7 +162,7 @@ test('urls -v', async () => { '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint(linuxSwapString('src//subproject/article.md', 'src//linter-test-A.md'))}\n`, ` [✖] ${linuxSwapString('https://github.com/holamgadol/foliant-md-linte', 'https://github.com/holamgadol/foliant-md-lint')} → Status: 404\n`, - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['urls', '-v'], '.') console.log(result) @@ -176,7 +176,7 @@ test('urls -v -s alt-src', async () => { '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['urls', '-v', '-s alt-src'], '.') console.log(result) @@ -190,7 +190,7 @@ test('urls -v -s alt-src -a', async () => { '--------------------------------------------------------------------------------\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['urls', '-v', '-s alt-src', '-a'], '.') console.log(result) @@ -201,7 +201,7 @@ test('urls -v -s alt-src -a', async () => { test('urls -v -s no-errors-src -a', async () => { const expectedStdout = [ 'Found 0 broken external links\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['urls', '-v', '-s no-errors-src', '-a'], '.') console.log(result) @@ -216,11 +216,11 @@ test('print', async () => { const expectedStdout = [ 'Checked 1 files\n', 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 1 broken external links\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['print'], '.', false) console.log(result) @@ -235,13 +235,13 @@ test('print -v', async () => { 'FILE: alt-src/linter-test-B.md\n', 'alt-src/linter-test-B.md:19 MD001/heading-increment/header-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]\n', 'alt-src/linter-test-B.md:33 MD024/no-duplicate-heading/no-duplicate-header Multiple headings with the same content [Context: "### MD001: Heading levels shou..."]\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 2 formatting errors\n', - `Full markdownlint log see in ${path.join(cwd, '.markdownlint.log')}\n`, + `Full markdownlint log see in .markdownlint.log\n`, 'Found 1 broken external links\n', `FILE: ${linkCheckFilePrint('alt-src//linter-test-B.md')}\n`, ' [✖] https://github.com/holamgadol/foliant-md-linters → Status: 404\n', - `Full markdown-link-check log see in ${path.join(cwd, '.markdownlinkcheck.log')}\n`] + `Full markdown-link-check log see in .markdownlinkcheck.log\n`] const result = await cli(['print', '-v'], '.', false) console.log(result)