Refactor dotnet-nunit parser to DotnetNunitParser

This commit is contained in:
Jozef Izso 2024-06-25 14:09:10 +02:00
parent d8481703bc
commit 1397b99b7c
4 changed files with 9 additions and 9 deletions

View file

@ -1,7 +1,7 @@
import * as fs from 'fs'
import * as path from 'path'
import {DotNetNunitParser} from '../src/parsers/dotnet-nunit/dotnet-nunit-parser'
import {DotnetNunitParser} from '../src/parsers/dotnet-nunit/dotnet-nunit-parser'
import {ParseOptions} from '../src/test-parser'
import {getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
@ -18,7 +18,7 @@ describe('dotnet-nunit tests', () => {
trackedFiles: ['DotnetTests.Unit/Calculator.cs', 'DotnetTests.NUnitV3Tests/CalculatorTests.cs']
}
const parser = new DotNetNunitParser(opts)
const parser = new DotnetNunitParser(opts)
const result = await parser.parse(filePath, fileContent)
expect(result).toMatchSnapshot()

8
dist/index.js generated vendored
View file

@ -427,7 +427,7 @@ class TestReporter {
case 'dart-json':
return new dart_json_parser_1.DartJsonParser(options, 'dart');
case 'dotnet-nunit':
return new dotnet_nunit_parser_1.DotNetNunitParser(options);
return new dotnet_nunit_parser_1.DotnetNunitParser(options);
case 'dotnet-trx':
return new dotnet_trx_parser_1.DotnetTrxParser(options);
case 'flutter-json':
@ -742,12 +742,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DotNetNunitParser = void 0;
exports.DotnetNunitParser = void 0;
const xml2js_1 = __nccwpck_require__(6189);
const node_utils_1 = __nccwpck_require__(5824);
const path_utils_1 = __nccwpck_require__(4070);
const test_results_1 = __nccwpck_require__(2768);
class DotNetNunitParser {
class DotnetNunitParser {
constructor(options) {
this.options = options;
}
@ -852,7 +852,7 @@ class DotNetNunitParser {
return ((_b = (_a = this.options.workDir) !== null && _a !== void 0 ? _a : this.assumedWorkDir) !== null && _b !== void 0 ? _b : (this.assumedWorkDir = (0, path_utils_1.getBasePath)(path, this.options.trackedFiles)));
}
}
exports.DotNetNunitParser = DotNetNunitParser;
exports.DotnetNunitParser = DotnetNunitParser;
/***/ }),

View file

@ -11,7 +11,7 @@ import {getAnnotations} from './report/get-annotations'
import {getReport} from './report/get-report'
import {DartJsonParser} from './parsers/dart-json/dart-json-parser'
import {DotNetNunitParser} from './parsers/dotnet-nunit/dotnet-nunit-parser'
import {DotnetNunitParser} from './parsers/dotnet-nunit/dotnet-nunit-parser'
import {DotnetTrxParser} from './parsers/dotnet-trx/dotnet-trx-parser'
import {JavaJunitParser} from './parsers/java-junit/java-junit-parser'
import {JestJunitParser} from './parsers/jest-junit/jest-junit-parser'
@ -216,7 +216,7 @@ class TestReporter {
case 'dart-json':
return new DartJsonParser(options, 'dart')
case 'dotnet-nunit':
return new DotNetNunitParser(options)
return new DotnetNunitParser(options)
case 'dotnet-trx':
return new DotnetTrxParser(options)
case 'flutter-json':

View file

@ -14,7 +14,7 @@ import {
TestCaseError
} from '../../test-results'
export class DotNetNunitParser implements TestParser {
export class DotnetNunitParser implements TestParser {
assumedWorkDir: string | undefined
constructor(readonly options: ParseOptions) {}