Add jest-junit fixture project

This commit is contained in:
Michal Dorner 2020-10-18 21:08:40 +02:00
parent 83a6323aa9
commit f861278768
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
7 changed files with 4835 additions and 1 deletions

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="jest tests" tests="6" failures="4" errors="0" time="1.349">
<testsuite name="Test 1" errors="0" failures="3" skipped="0" timestamp="2020-10-18T19:07:47" time="0.487" tests="4">
<testcase classname="Test 1 Passing test" name="Test 1 Passing test" time="0.002">
</testcase>
<testcase classname="Test 1 Test 1.1 Failing test" name="Test 1 Test 1.1 Failing test" time="0.001">
<failure>Error: expect(received).toBeTruthy()
Received: false
at Object.test (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\__tests__\main.test.js:10:21)
at Object.asyncJestTest (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\jasmineAsyncInstall.js:106:37)
at resolve (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\queueRunner.js:45:12)
at new Promise (&lt;anonymous&gt;)
at mapper (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\queueRunner.js:28:19)
at promise.then (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\queueRunner.js:75:41)
at process._tickCallback (internal/process/next_tick.js:68:7)</failure>
</testcase>
<testcase classname="Test 1 Test 1.1 Exception in target unit" name="Test 1 Test 1.1 Exception in target unit" time="0.001">
<failure>Error: Some error
at Object.throwError (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\lib\main.js:2:9)
at Object.test (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\__tests__\main.test.js:14:11)
at Object.asyncJestTest (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\jasmineAsyncInstall.js:106:37)
at resolve (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\queueRunner.js:45:12)
at new Promise (&lt;anonymous&gt;)
at mapper (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\queueRunner.js:28:19)
at promise.then (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\queueRunner.js:75:41)
at process._tickCallback (internal/process/next_tick.js:68:7)</failure>
</testcase>
<testcase classname="Test 2 Exception in test" name="Test 2 Exception in test" time="0">
<failure>Error: Some error
at Object.test (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\__tests__\main.test.js:21:11)
at Object.asyncJestTest (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\jasmineAsyncInstall.js:106:37)
at resolve (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\queueRunner.js:45:12)
at new Promise (&lt;anonymous&gt;)
at mapper (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\queueRunner.js:28:19)
at promise.then (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\queueRunner.js:75:41)
at process._tickCallback (internal/process/next_tick.js:68:7)</failure>
</testcase>
</testsuite>
<testsuite name="undefined" errors="0" failures="1" skipped="1" timestamp="2020-10-18T19:07:47" time="0.089" tests="2">
<testcase classname=" Timeout test" name=" Timeout test" time="0.002">
<failure>: Timeout - Async callback was not invoked within the 1 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 1 ms timeout specified by jest.setTimeout.Error:
at new Spec (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\jasmine\Spec.js:116:22)
at new Spec (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\setup_jest_globals.js:78:9)
at specFactory (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\jasmine\Env.js:523:24)
at Env.it (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\jasmine\Env.js:592:24)
at Env.it (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\jasmineAsyncInstall.js:134:23)
at it (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\jasmine\jasmineLight.js:100:21)
at Object.&lt;anonymous&gt; (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\__tests__\second.test.js:1:34)
at Runtime._execModule (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-runtime\build\index.js:1245:24)
at Runtime._loadModule (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-runtime\build\index.js:844:12)
at Runtime.requireModule (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-runtime\build\index.js:694:10)
at jasmine2 (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-jasmine2\build\index.js:230:13)
at runTestInternal (C:\Users\Michal\Workspace\dorny\test-check\reports\jest\node_modules\jest-runner\build\runTest.js:380:22)</failure>
</testcase>
<testcase classname=" Skipped test" name=" Skipped test" time="0">
<skipped/>
</testcase>
</testsuite>
</testsuites>

View file

@ -13,7 +13,8 @@
"test": "jest",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
"dotnet-fixture": "dotnet test reports/dotnet/DotnetTests.XUnitTests --logger \"trx;LogFileName=../../../../__tests__/fixtures/dotnet-trx.trx\"",
"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\"",
"jest-fixture": "cd \"reports/jest\" && npm test"
},
"repository": {
"type": "git",

View file

@ -0,0 +1,23 @@
const lib = require('../lib/main')
describe('Test 1', () => {
test('Passing test', () => {
expect(true).toBeTruthy()
});
describe('Test 1.1', () => {
test('Failing test', () => {
expect(false).toBeTruthy()
});
test('Exception in target unit', () => {
lib.throwError();
});
});
});
describe('Test 2', () => {
test('Exception in test', () => {
throw new Error('Some error');
});
});

View file

@ -0,0 +1,7 @@
test('Timeout test', async () => {
await new Promise(resolve => setTimeout(resolve, 1000));
}, 1);
test.skip('Skipped test', () => {
// do nothing
});

5
reports/jest/lib/main.js Normal file
View file

@ -0,0 +1,5 @@
function throwError() {
throw new Error('Some error')
}
exports.throwError = throwError

4717
reports/jest/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

21
reports/jest/package.json Normal file
View file

@ -0,0 +1,21 @@
{
"name": "jest-fixture",
"version": "0.0.0",
"private": true,
"description": "Generates test fixtures for test-check action",
"scripts": {
"test": "jest --ci --reporters=default --reporters=jest-junit"
},
"author": "Michal Dorner <dorner.michal@gmail.com>",
"license": "MIT",
"devDependencies": {
"jest": "^26.5.3",
"jest-junit": "^12.0.0"
},
"jest-junit": {
"suiteName": "jest tests",
"outputDirectory": "../../__tests__/fixtures",
"outputName": "jest-junit.xml",
"uniqueOutputName": "false"
}
}