Skip to content

Commit

Permalink
Add jest-junit fixture project
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Dorner committed Oct 18, 2020
1 parent 83a6323 commit f861278
Show file tree
Hide file tree
Showing 7 changed files with 4,835 additions and 1 deletion.
60 changes: 60 additions & 0 deletions __tests__/fixtures/jest-junit.xml
Original file line number Diff line number Diff line change
@@ -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>
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 23 additions & 0 deletions reports/jest/__tests__/main.test.js
Original file line number Diff line number Diff line change
@@ -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');
});
});
7 changes: 7 additions & 0 deletions reports/jest/__tests__/second.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test('Timeout test', async () => {
await new Promise(resolve => setTimeout(resolve, 1000));
}, 1);

test.skip('Skipped test', () => {
// do nothing
});
5 changes: 5 additions & 0 deletions reports/jest/lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function throwError() {
throw new Error('Some error')
}

exports.throwError = throwError
Loading

0 comments on commit f861278

Please sign in to comment.