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:
parent
ef1f9a4e60
commit
4d6f6ca5f4
18 changed files with 119 additions and 56 deletions
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {DartJsonParser} from '../src/parsers/dart-json/dart-json-parser'
|
import {DartJsonParser} from '../src/parsers/dart-json/dart-json-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
|
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('dart-json tests', () => {
|
||||||
it('produces empty test run result when there are no test cases', async () => {
|
it('produces empty test run result when there are no test cases', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
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.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
|
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('dotnet-nunit tests', () => {
|
||||||
it('report from ./reports/dotnet test results matches snapshot', async () => {
|
it('report from ./reports/dotnet test results matches snapshot', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {DotnetTrxParser} from '../src/parsers/dotnet-trx/dotnet-trx-parser'
|
import {DotnetTrxParser} from '../src/parsers/dotnet-trx/dotnet-trx-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {DEFAULT_OPTIONS, getReport, ReportOptions} from '../src/report/get-report'
|
import {DEFAULT_OPTIONS, getReport, ReportOptions} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('dotnet-trx tests', () => {
|
||||||
it('produces empty test run result when there are no test cases', async () => {
|
it('produces empty test run result when there are no test cases', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {GolangJsonParser} from '../src/parsers/golang-json/golang-json-parser'
|
import {GolangJsonParser} from '../src/parsers/golang-json/golang-json-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {getReport} from '../src/report/get-report'
|
import {getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('golang-json tests', () => {
|
||||||
it('report from ./reports/dotnet test results matches snapshot', async () => {
|
it('report from ./reports/dotnet test results matches snapshot', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {JavaJunitParser} from '../src/parsers/java-junit/java-junit-parser'
|
import {JavaJunitParser} from '../src/parsers/java-junit/java-junit-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
|
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('java-junit tests', () => {
|
||||||
it('produces empty test run result when there are no test cases', async () => {
|
it('produces empty test run result when there are no test cases', async () => {
|
||||||
|
|
|
||||||
|
|
@ -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', () => {
|
describe('parseStackTraceLine tests', () => {
|
||||||
it('empty line is not parsed', async () => {
|
it('empty line is not parsed', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {JestJunitParser} from '../src/parsers/jest-junit/jest-junit-parser'
|
import {JestJunitParser} from '../src/parsers/jest-junit/jest-junit-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
|
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('jest-junit tests', () => {
|
||||||
it('produces empty test run result when there are no test cases in the testsuites element', async () => {
|
it('produces empty test run result when there are no test cases in the testsuites element', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {MochaJsonParser} from '../src/parsers/mocha-json/mocha-json-parser'
|
import {MochaJsonParser} from '../src/parsers/mocha-json/mocha-json-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
|
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('mocha-json tests', () => {
|
||||||
it('produces empty test run result when there are no test cases', async () => {
|
it('produces empty test run result when there are no test cases', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {PhpunitJunitParser} from '../src/parsers/phpunit-junit/phpunit-junit-parser'
|
import {PhpunitJunitParser} from '../src/parsers/phpunit-junit/phpunit-junit-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {getReport} from '../src/report/get-report'
|
import {getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('phpunit-junit tests', () => {
|
||||||
it('produces empty test run result when there are no test cases', async () => {
|
it('produces empty test run result when there are no test cases', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {PythonXunitParser} from '../src/parsers/python-xunit/python-xunit-parser'
|
import {PythonXunitParser} from '../src/parsers/python-xunit/python-xunit-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
|
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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 = {
|
const defaultOpts: ParseOptions = {
|
||||||
parseErrors: true,
|
parseErrors: true,
|
||||||
|
|
|
||||||
|
|
@ -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('getBadge', () => {
|
||||||
describe('URI encoding with special characters', () => {
|
describe('URI encoding with special characters', () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {RspecJsonParser} from '../src/parsers/rspec-json/rspec-json-parser'
|
import {RspecJsonParser} from '../src/parsers/rspec-json/rspec-json-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
|
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('rspec-json tests', () => {
|
||||||
it('produces empty test run result when there are no test cases', async () => {
|
it('produces empty test run result when there are no test cases', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {SwiftXunitParser} from '../src/parsers/swift-xunit/swift-xunit-parser'
|
import {SwiftXunitParser} from '../src/parsers/swift-xunit/swift-xunit-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report'
|
import {DEFAULT_OPTIONS, getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('swift-xunit tests', () => {
|
||||||
it('report from swift test results matches snapshot', async () => {
|
it('report from swift test results matches snapshot', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import {NetteTesterJunitParser} from '../src/parsers/tester-junit/tester-junit-parser'
|
import {NetteTesterJunitParser} from '../src/parsers/tester-junit/tester-junit-parser.js'
|
||||||
import {ParseOptions} from '../src/test-parser'
|
import {ParseOptions} from '../src/test-parser.js'
|
||||||
import {getReport} from '../src/report/get-report'
|
import {getReport} from '../src/report/get-report.js'
|
||||||
import {normalizeFilePath} from '../src/utils/path-utils'
|
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', () => {
|
describe('tester-junit tests', () => {
|
||||||
it('produces empty test run result when there are no test cases', async () => {
|
it('produces empty test run result when there are no test cases', async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {parseNetDuration} from '../../src/utils/parse-utils'
|
import {parseNetDuration} from '../../src/utils/parse-utils.js'
|
||||||
|
|
||||||
describe('parseNetDuration', () => {
|
describe('parseNetDuration', () => {
|
||||||
it('returns 0 for 00:00:00', () => {
|
it('returns 0 for 00:00:00', () => {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,12 @@ module.exports = {
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
moduleFileExtensions: ['js', 'ts'],
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
testMatch: ['**/*.test.ts'],
|
testMatch: ['**/*.test.ts'],
|
||||||
testRunner: 'jest-circus/runner',
|
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': ['ts-jest', {useESM: true}]
|
||||||
},
|
},
|
||||||
|
moduleNameMapper: {
|
||||||
|
'^(\\.{1,2}/.*)\\.js$': '$1'
|
||||||
|
},
|
||||||
|
extensionsToTreatAsEsm: ['.ts'],
|
||||||
verbose: true
|
verbose: true
|
||||||
}
|
}
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
"lint": "eslint src/**/*.ts",
|
"lint": "eslint src/**/*.ts",
|
||||||
"package": "ncc build --license licenses.txt && eolConverter lf 'dist/*'",
|
"package": "ncc build --license licenses.txt && eolConverter lf 'dist/*'",
|
||||||
"version": "npm run build && npm run package && git add 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",
|
"jest:updatesnapshot": "jest --updateSnapshot",
|
||||||
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
|
"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\"",
|
"dart-fixture": "cd \"reports/dart\" && dart test --file-reporter=\"json:../../__tests__/fixtures/dart-json.json\"",
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"moduleResolution": "node16",
|
"moduleResolution": "nodenext",
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
|
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue