1
0
Fork 0
mirror of https://github.com/dorny/test-reporter.git synced 2026-03-21 23:52:12 +01:00

Refactor tests to modedules based package

This commit is contained in:
Jozef Izso 2026-03-02 14:29:31 +01:00
parent ef1f9a4e60
commit 4d6f6ca5f4
Failed to extract signature
18 changed files with 119 additions and 56 deletions

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {DartJsonParser} from '../src/parsers/dart-json/dart-json-parser'
import {ParseOptions} from '../src/test-parser'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {DartJsonParser} from '../src/parsers/dart-json/dart-json-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('dart-json tests', () => {
it('produces empty test run result when there are no test cases', async () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {DotnetNunitParser} from '../src/parsers/dotnet-nunit/dotnet-nunit-parser'
import {ParseOptions} from '../src/test-parser'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {DotnetNunitParser} from '../src/parsers/dotnet-nunit/dotnet-nunit-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('dotnet-nunit tests', () => {
it('report from ./reports/dotnet test results matches snapshot', async () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {DotnetTrxParser} from '../src/parsers/dotnet-trx/dotnet-trx-parser'
import {ParseOptions} from '../src/test-parser'
import {DEFAULT_OPTIONS, getReport, ReportOptions} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {DotnetTrxParser} from '../src/parsers/dotnet-trx/dotnet-trx-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {DEFAULT_OPTIONS, getReport, ReportOptions} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('dotnet-trx tests', () => {
it('produces empty test run result when there are no test cases', async () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {GolangJsonParser} from '../src/parsers/golang-json/golang-json-parser'
import {ParseOptions} from '../src/test-parser'
import {getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {GolangJsonParser} from '../src/parsers/golang-json/golang-json-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('golang-json tests', () => {
it('report from ./reports/dotnet test results matches snapshot', async () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {JavaJunitParser} from '../src/parsers/java-junit/java-junit-parser'
import {ParseOptions} from '../src/test-parser'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {JavaJunitParser} from '../src/parsers/java-junit/java-junit-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('java-junit tests', () => {
it('produces empty test run result when there are no test cases', async () => {

View file

@ -1,4 +1,4 @@
import {parseStackTraceElement} from '../src/parsers/java-junit/java-stack-trace-element-parser'
import {parseStackTraceElement} from '../src/parsers/java-junit/java-stack-trace-element-parser.js'
describe('parseStackTraceLine tests', () => {
it('empty line is not parsed', async () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {JestJunitParser} from '../src/parsers/jest-junit/jest-junit-parser'
import {ParseOptions} from '../src/test-parser'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {JestJunitParser} from '../src/parsers/jest-junit/jest-junit-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('jest-junit tests', () => {
it('produces empty test run result when there are no test cases in the testsuites element', async () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {MochaJsonParser} from '../src/parsers/mocha-json/mocha-json-parser'
import {ParseOptions} from '../src/test-parser'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {MochaJsonParser} from '../src/parsers/mocha-json/mocha-json-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('mocha-json tests', () => {
it('produces empty test run result when there are no test cases', async () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {PhpunitJunitParser} from '../src/parsers/phpunit-junit/phpunit-junit-parser'
import {ParseOptions} from '../src/test-parser'
import {getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {PhpunitJunitParser} from '../src/parsers/phpunit-junit/phpunit-junit-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('phpunit-junit tests', () => {
it('produces empty test run result when there are no test cases', async () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {PythonXunitParser} from '../src/parsers/python-xunit/python-xunit-parser'
import {ParseOptions} from '../src/test-parser'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {PythonXunitParser} from '../src/parsers/python-xunit/python-xunit-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const defaultOpts: ParseOptions = {
parseErrors: true,

View file

@ -1,4 +1,4 @@
import {getBadge, DEFAULT_OPTIONS, ReportOptions} from '../../src/report/get-report'
import {getBadge, DEFAULT_OPTIONS, ReportOptions} from '../../src/report/get-report.js'
describe('getBadge', () => {
describe('URI encoding with special characters', () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {RspecJsonParser} from '../src/parsers/rspec-json/rspec-json-parser'
import {ParseOptions} from '../src/test-parser'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {RspecJsonParser} from '../src/parsers/rspec-json/rspec-json-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('rspec-json tests', () => {
it('produces empty test run result when there are no test cases', async () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {SwiftXunitParser} from '../src/parsers/swift-xunit/swift-xunit-parser'
import {ParseOptions} from '../src/test-parser'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {SwiftXunitParser} from '../src/parsers/swift-xunit/swift-xunit-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('swift-xunit tests', () => {
it('report from swift test results matches snapshot', async () => {

View file

@ -1,10 +1,15 @@
import * as fs from 'fs'
import * as path from 'path'
import {NetteTesterJunitParser} from '../src/parsers/tester-junit/tester-junit-parser'
import {ParseOptions} from '../src/test-parser'
import {getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/path-utils'
import {NetteTesterJunitParser} from '../src/parsers/tester-junit/tester-junit-parser.js'
import {ParseOptions} from '../src/test-parser.js'
import {getReport} from '../src/report/get-report.js'
import {normalizeFilePath} from '../src/utils/path-utils.js'
import {fileURLToPath} from 'url'
import {dirname} from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
describe('tester-junit tests', () => {
it('produces empty test run result when there are no test cases', async () => {

View file

@ -1,4 +1,4 @@
import {parseNetDuration} from '../../src/utils/parse-utils'
import {parseNetDuration} from '../../src/utils/parse-utils.js'
describe('parseNetDuration', () => {
it('returns 0 for 00:00:00', () => {

View file

@ -3,9 +3,12 @@ module.exports = {
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
'^.+\\.ts$': ['ts-jest', {useESM: true}]
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1'
},
extensionsToTreatAsEsm: ['.ts'],
verbose: true
}
}

View file

@ -12,7 +12,7 @@
"lint": "eslint src/**/*.ts",
"package": "ncc build --license licenses.txt && eolConverter lf 'dist/*'",
"version": "npm run build && npm run package && git add dist/*",
"test": "jest --ci --reporters=default --reporters=jest-junit",
"test": "NODE_OPTIONS='--experimental-vm-modules' jest --ci --reporters=default --reporters=jest-junit",
"jest:updatesnapshot": "jest --updateSnapshot",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
"dart-fixture": "cd \"reports/dart\" && dart test --file-reporter=\"json:../../__tests__/fixtures/dart-json.json\"",

View file

@ -7,7 +7,7 @@
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node16",
"moduleResolution": "nodenext",
"isolatedModules": true,
"outDir": "./lib",