0.0.33 • Published 10 months ago

@tsdoc-test-reporter/core v0.0.33

Weekly downloads
-
License
-
Repository
-
Last release
10 months 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.33

10 months ago

0.0.32

1 year ago

0.0.31

1 year ago

0.0.30

1 year ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.20

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago