0.0.32 • Published 24 days ago

@tsdoc-test-reporter/core v0.0.32

Weekly downloads
-
License
-
Repository
-
Last release
24 days ago

@tsdoc-test-reporter/core

@tsdoc-test-reporter/core contains the main logic for parsing comment tags from a TypeScript file. It requires a TypeScript SourceFile and the TSDocParser from @microsoft/tsdoc.

Installing

npm install @tsdoc-test-reporter/core

Testing

pnpm nx test core

Minimal required setup

Below is a the minimal required setup to be able to parse a source file. You will need to load the source files yourself similar to the example.

import { TSDocParser } from '@microsoft/tsdoc';

import { CompilerOptions, createProgram, ScriptTarget, SourceFile } from 'typescript';

const program = createProgram(['myFileName.ts'], { target: ScriptTarget.Latest });

const sourceFile = program.getSourceFile('myFileName.ts');

const { testBlockDocComments } = new CommentTagParser({
	sourceFile,
	tsDocParser: new TSDocParser(),
});

Custom tags

Example for parsing test files where you have custom TSDoc tags.

import {
	TSDocConfiguration,
	TSDocParser,
	TSDocTagDefinition,
	TSDocTagSyntaxKind,
} from '@microsoft/tsdoc';

import { CompilerOptions, createProgram, ScriptTarget, SourceFile } from 'typescript';

const program = createProgram(['myFileName.ts'], { target: ScriptTarget.Latest });

const sourceFile = program.getSourceFile('myFileName.ts');

const config = new TSDocConfiguration();
const customBlockDefinition = new TSDocTagDefinition({
	tagName: '@custom',
	syntaxKind: TSDocTagSyntaxKind.BlockTag,
});
config.addTagDefinition(customBlockDefinition);

const { testBlockDocComments } = new CommentTagParser<'@custom'>({
	sourceFile,
	tsDocParser: new TSDocParser(config),
});
0.0.32

24 days ago

0.0.31

3 months ago

0.0.30

3 months ago

0.0.29

7 months ago

0.0.28

7 months ago

0.0.27

7 months ago

0.0.26

7 months ago

0.0.25

7 months ago

0.0.24

7 months ago

0.0.23

7 months ago

0.0.22

7 months ago

0.0.20

7 months ago

0.0.18

7 months ago

0.0.17

7 months ago

0.0.16

7 months ago

0.0.15

7 months ago

0.0.14

7 months ago

0.0.13

7 months ago

0.0.12

7 months ago

0.0.11

7 months ago

0.0.10

7 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

8 months ago

0.0.1

8 months ago