@diplodoc/cli-tests 5.0.3 → 5.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ exports[`Regression > internal > filelist 1`] = `
6
6
  "_assets/1.png",
7
7
  "_assets/2.png",
8
8
  "_assets/3.png",
9
+ "_assets/5_1.png",
9
10
  "_assets/empty.pdf",
10
11
  "autotitle.md",
11
12
  "generic/1.md",
@@ -40,6 +41,7 @@ exports[`Regression > internal > filelist 2`] = `
40
41
  "_assets/1.png",
41
42
  "_assets/2.png",
42
43
  "_assets/3.png",
44
+ "_assets/5_1.png",
43
45
  "_assets/empty.pdf",
44
46
  "_bundle/search-async-1",
45
47
  "_bundle/search-async-0",
@@ -225,6 +227,8 @@ metadata:
225
227
  ![with trailing comment](_assets/3.png)<!-- comment -->
226
228
 
227
229
  <!-- ![commented](_assets/4.png) -->
230
+
231
+ ![with backslash](_assets/5/_1.png)
228
232
  "
229
233
  `;
230
234
 
@@ -937,7 +941,7 @@ exports[`Regression > internal 34`] = `
937
941
  <body class="g-root g-root_theme_light">
938
942
  <div id="root"></div>
939
943
  <script type="application/json" id="diplodoc-state">
940
- {"data":{"leading":false,"html":"&lt;p&gt;&lt;img src=\\"_assets/1.png\\" alt=\\"simple image\\" /&gt;&lt;/p&gt;/n![with leading comment](_assets/2.png)/n&lt;p&gt;&lt;img src=\\"_assets/3.png\\" alt=\\"with trailing comment\\" /&gt;&lt;/p&gt;/n/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[],"title":"Images"},"router":{"pathname":"images","depth":1,"base":"./"},"lang":"ru","langs":["ru"]}
944
+ {"data":{"leading":false,"html":"&lt;p&gt;&lt;img src=\\"_assets/1.png\\" alt=\\"simple image\\" /&gt;&lt;/p&gt;/n![with leading comment](_assets/2.png)/n&lt;p&gt;&lt;img src=\\"_assets/3.png\\" alt=\\"with trailing comment\\" /&gt;&lt;/p&gt;/n/n&lt;p&gt;&lt;img src=\\"_assets/5_1.png\\" alt=\\"with backslash\\" /&gt;&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}]},"headings":[],"title":"Images"},"router":{"pathname":"images","depth":1,"base":"./"},"lang":"ru","langs":["ru"]}
941
945
  </script>
942
946
  <script type="application/javascript">
943
947
  const data = document.querySelector('script#diplodoc-state');
@@ -83,10 +83,10 @@ metadata:
83
83
  - name: generator
84
84
  content: Diplodoc Platform vDIPLODOC-VERSION
85
85
  restricted-access:
86
- - - userAtoc2
87
- - userBtoc2
88
86
  - - userA
89
87
  - userB
88
+ - - userAtoc2
89
+ - userBtoc2
90
90
  ---
91
91
  This is the /folder1/a1.md file content.
92
92
  "
@@ -98,10 +98,10 @@ metadata:
98
98
  - name: generator
99
99
  content: Diplodoc Platform vDIPLODOC-VERSION
100
100
  restricted-access:
101
- - - userAtoc3
102
- - userBtoc3
103
101
  - - userA
104
102
  - userB
103
+ - - userAtoc3
104
+ - userBtoc3
105
105
  ---
106
106
  This is the /folder1/folder1/a1.md file content.
107
107
  "
@@ -1,6 +1,13 @@
1
+ import type {Report} from '../fixtures/runners/types';
2
+
1
3
  import {describe, expect, it} from 'vitest';
2
4
  import {TestAdapter, getTestPaths} from '../fixtures';
3
5
 
6
+ type TestResult = {
7
+ md: Report;
8
+ html: Report;
9
+ }
10
+
4
11
  function test(path: string, expect: Function) {
5
12
  it(path, async () => {
6
13
  const {inputPath, outputPath} = getTestPaths(path);
@@ -13,8 +20,7 @@ function test(path: string, expect: Function) {
13
20
  }
14
21
 
15
22
  describe('Errors', () => {
16
- test('mocks/errors/unreachable-link', ({md, html}) => {
17
- // console.log(md, html);
23
+ test('mocks/errors/unreachable-link', ({html}: TestResult) => {
18
24
  expectErrors(html, [
19
25
  'ERR index.md: 1: YFM003 / unreachable-link Link is unreachable [Context: "[Unreachable link: "exists.html"][existing file](./exists.md)"]',
20
26
  'ERR index.md: 2: YFM003 / unreachable-link Link is unreachable [Context: "[Unreachable link: "missed.html"][missed file](./missed.md)"]'
@@ -30,8 +30,6 @@ class Build {
30
30
  '--quiet',
31
31
  '--allowHTML',
32
32
  ...args,
33
- '-e',
34
- 'report-logs',
35
33
  ]);
36
34
  }
37
35
  }
@@ -9,7 +9,7 @@ export class BinaryRunner implements Runner {
9
9
  }
10
10
 
11
11
  async runYfmDocs(argv: string[]) {
12
- const {stderr, exitCode} = await execa(this.binaryPath, argv, {all: true});
12
+ const {stderr, exitCode} = await execa(this.binaryPath, argv, {all: true, reject: false});
13
13
  const report = {
14
14
  code: exitCode || 0,
15
15
  warns: fillLog(/^WARN/, stderr),
@@ -28,5 +28,8 @@ export class BinaryRunner implements Runner {
28
28
  }
29
29
 
30
30
  function fillLog(filter: RegExp, source: string) {
31
- return source.split('\n').filter((line) => line.match(filter));
31
+ return source.split('\n')
32
+ .filter((line) => line.match(filter))
33
+ .map((line) => line.trim())
34
+ .filter(Boolean);
32
35
  }
@@ -1,3 +1,5 @@
1
+ import {resolve} from 'node:path';
2
+
1
3
  import {SourceRunner} from './source';
2
4
  import {BinaryRunner} from './binary';
3
5
  import {Runner} from './types';
@@ -5,7 +7,7 @@ import {Runner} from './types';
5
7
  export {Runner};
6
8
 
7
9
  export function createRunner(): Runner {
8
- const binaryPath = process.env.DIPLODOC_BINARY_PATH;
10
+ const binaryPath = process.env.DIPLODOC_BINARY_PATH || resolve(__dirname, '../../../build/index.js');
9
11
 
10
12
  if (binaryPath) {
11
13
  return new BinaryRunner(binaryPath);
File without changes
@@ -7,3 +7,5 @@
7
7
  ![with trailing comment](_assets/3.png)<!-- comment -->
8
8
 
9
9
  <!-- ![commented](_assets/4.png) -->
10
+
11
+ ![with backslash](_assets/5\_1.png)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.0.3",
3
+ "version": "5.0.5",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },
package/vitest.config.ts CHANGED
@@ -17,10 +17,9 @@ export default defineConfig({
17
17
  environment: 'node',
18
18
  include: [
19
19
  'e2e/**/*.{test,spec}.ts',
20
- 'units/**/*.{test,spec}.ts',
21
20
  ...resolvedTestPaths.map((path) => `${path}/**/*.{test,spec}.ts`),
22
21
  ],
23
- exclude: ['node_modules', 'dist'],
22
+ exclude: ['node_modules'],
24
23
  coverage: {
25
24
  enabled: false,
26
25
  },