Skip to content

Commit

Permalink
- upgrade all dev dependencies to their latest release versions
Browse files Browse the repository at this point in the history
- move to eslint 9
- format all files
  • Loading branch information
mikepenz committed Nov 28, 2024
1 parent 9ffe999 commit ca9f44b
Show file tree
Hide file tree
Showing 9 changed files with 597 additions and 437 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

54 changes: 0 additions & 54 deletions .eslintrc.json

This file was deleted.

98 changes: 37 additions & 61 deletions __tests__/table.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,37 @@ jest.setTimeout(30000)
const NORMAL_TABLE = [
[
{
'data': '',
'header': true
data: '',
header: true
},
{
'data': 'Tests',
'header': true
data: 'Tests',
header: true
},
{
'data': 'Passed ✅',
'header': true
data: 'Passed ✅',
header: true
},
{
'data': 'Skipped ⏭️',
'header': true
data: 'Skipped ⏭️',
header: true
},
{
'data': 'Failed ❌',
'header': true
data: 'Failed ❌',
header: true
}
],
[
'checkName',
'3 ran',
'3 passed',
'0 skipped',
'0 failed'
]
['checkName', '3 ran', '3 passed', '0 skipped', '0 failed']
]
const FLAKY_TABLE = [
[
{
'data': 'Test',
'header': true
data: 'Test',
header: true
},
{
'data': 'Retries',
'header': true
data: 'Retries',
header: true
}
]
]
Expand All @@ -71,32 +65,23 @@ describe('buildSummaryTables', () => {
expect(detailTable).toStrictEqual([
[
{
"data": "Test",
"header": true
data: 'Test',
header: true
},
{
"data": "Result",
"header": true
data: 'Result',
header: true
}
],
[
{
"data": "<strong>checkName</strong>",
"colspan": "2"
data: '<strong>checkName</strong>',
colspan: '2'
}
],
[
"ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)",
"✅ pass"
],
[
"ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)",
"✅ pass"
],
[
"ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)",
"✅ pass"
]
['ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)', '✅ pass'],
['ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)', '✅ pass'],
['ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)', '✅ pass']
])
expect(flakyTable).toStrictEqual(FLAKY_TABLE)
})
Expand All @@ -121,44 +106,35 @@ describe('buildSummaryTables', () => {
expect(detailTable).toStrictEqual([
[
{
"data": "Test",
"header": true
data: 'Test',
header: true
},
{
"data": "Result",
"header": true
data: 'Result',
header: true
}
],
[
{
"data": "<strong>checkName</strong>",
"colspan": "2"
data: '<strong>checkName</strong>',
colspan: '2'
}
],
[
{
"data": "<em>ABC-0199: XMPP Ping</em>",
"colspan": "2"
data: '<em>ABC-0199: XMPP Ping</em>',
colspan: '2'
}
],
[
"ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)",
"✅ pass"
],
[
"ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)",
"✅ pass"
],
['ABC-0199: XMPP Ping/PingIntegrationTest.pingAsync (Normal)', '✅ pass'],
['ABC-0199: XMPP Ping/PingIntegrationTest.pingServer (Normal)', '✅ pass'],
[
{
"data": "<em>ABC-0045: Multi-User Chat</em>",
"colspan": "2"
data: '<em>ABC-0045: Multi-User Chat</em>',
colspan: '2'
}
],
[
"ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)",
"✅ pass"
]
['ABC-0045: Multi-User Chat/MultiUserIntegrationTest.mucRoleTestForReceivingModerator (Normal)', '✅ pass']
])
expect(flakyTable).toStrictEqual(FLAKY_TABLE)
})
Expand Down
86 changes: 31 additions & 55 deletions __tests__/testParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ describe('parseFile', () => {
annotation_level: 'failure',
status: 'failure',
title: 'test_sample.test_which_fails',
message: 'AssertionError: assert \'test\' == \'xyz\'\n - xyz\n + test',
message: "AssertionError: assert 'test' == 'xyz'\n - xyz\n + test",
raw_details:
'def test_which_fails():\n event = { \'attr\': \'test\'}\n> assert event[\'attr\'] == \'xyz\'\nE AssertionError: assert \'test\' == \'xyz\'\nE - xyz\nE + test\n\npython/test_sample.py:10: AssertionError'
"def test_which_fails():\n event = { 'attr': 'test'}\n> assert event['attr'] == 'xyz'\nE AssertionError: assert 'test' == 'xyz'\nE - xyz\nE + test\n\npython/test_sample.py:10: AssertionError"
},
{
path: 'test_results/python/test_sample.py',
Expand All @@ -256,9 +256,9 @@ describe('parseFile', () => {
annotation_level: 'failure',
status: 'failure',
title: 'test_sample.test_with_error',
message: 'AttributeError: \'dict\' object has no attribute \'attr\'',
message: "AttributeError: 'dict' object has no attribute 'attr'",
raw_details:
'def test_with_error():\n event = { \'attr\': \'test\'}\n> assert event.attr == \'test\'\nE AttributeError: \'dict\' object has no attribute \'attr\'\n\npython/test_sample.py:14: AttributeError'
"def test_with_error():\n event = { 'attr': 'test'}\n> assert event.attr == 'test'\nE AttributeError: 'dict' object has no attribute 'attr'\n\npython/test_sample.py:14: AttributeError"
}
])
})
Expand Down Expand Up @@ -292,9 +292,9 @@ describe('parseFile', () => {
annotation_level: 'failure',
status: 'failure',
title: 'pytest/test_which_fails',
message: 'AssertionError: assert \'test\' == \'xyz\'\n - xyz\n + test',
message: "AssertionError: assert 'test' == 'xyz'\n - xyz\n + test",
raw_details:
'def test_which_fails():\n event = { \'attr\': \'test\'}\n> assert event[\'attr\'] == \'xyz\'\nE AssertionError: assert \'test\' == \'xyz\'\nE - xyz\nE + test\n\npython/test_sample.py:10: AssertionError'
"def test_which_fails():\n event = { 'attr': 'test'}\n> assert event['attr'] == 'xyz'\nE AssertionError: assert 'test' == 'xyz'\nE - xyz\nE + test\n\npython/test_sample.py:10: AssertionError"
},
{
path: 'subproject/test_results/python/test_sample.py',
Expand All @@ -306,17 +306,15 @@ describe('parseFile', () => {
annotation_level: 'failure',
status: 'failure',
title: 'pytest/test_with_error',
message: 'AttributeError: \'dict\' object has no attribute \'attr\'',
message: "AttributeError: 'dict' object has no attribute 'attr'",
raw_details:
'def test_with_error():\n event = { \'attr\': \'test\'}\n> assert event.attr == \'test\'\nE AttributeError: \'dict\' object has no attribute \'attr\'\n\npython/test_sample.py:14: AttributeError'
"def test_with_error():\n event = { 'attr': 'test'}\n> assert event.attr == 'test'\nE AttributeError: 'dict' object has no attribute 'attr'\n\npython/test_sample.py:14: AttributeError"
}
])
})

it('should parse marathon results', async () => {
const testResult = await parseFile(
'test_results/marathon_tests/com.mikepenz.DummyTest#test_02_dummy.xml'
)
const testResult = await parseFile('test_results/marathon_tests/com.mikepenz.DummyTest#test_02_dummy.xml')
expect(testResult).toBeDefined()
const {totalCount, skippedCount, globalAnnotations} = testResult!!
const filtered = globalAnnotations.filter(annotation => annotation.annotation_level !== 'notice')
Expand All @@ -327,9 +325,7 @@ describe('parseFile', () => {
})

it('should parse marathon results and retrieve message', async () => {
const testResult = await parseFile(
'test_results/marathon_tests/com.mikepenz.DummyTest3#test_01.xml'
)
const testResult = await parseFile('test_results/marathon_tests/com.mikepenz.DummyTest3#test_01.xml')
expect(testResult).toBeDefined()
const {totalCount, skippedCount, globalAnnotations} = testResult!!

Expand All @@ -353,9 +349,7 @@ describe('parseFile', () => {
})

it('should parse and fail marathon results', async () => {
const testResult = await parseFile(
'test_results/marathon_tests/com.mikepenz.DummyUtilTest#test_01_dummy.xml'
)
const testResult = await parseFile('test_results/marathon_tests/com.mikepenz.DummyUtilTest#test_01_dummy.xml')
expect(testResult).toBeDefined()
const {totalCount, skippedCount, globalAnnotations} = testResult!!

Expand Down Expand Up @@ -837,7 +831,8 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
retries: 0,
annotation_level: 'notice',
status: 'success',
title: 'default config/Config files default config projectUTCOffset should be a callable with current UTC offset',
title:
'default config/Config files default config projectUTCOffset should be a callable with current UTC offset',
message: 'Config files default config projectUTCOffset should be a callable with current UTC offset',
raw_details: ''
}
Expand Down Expand Up @@ -987,14 +982,10 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
})

it('should handle retries', async () => {
const testResult = await parseFile(
'test_results/junit-web-test/expectedRetries.xml',
'',
false,
false,
true,
['/build/', '/__pycache__/']
)
const testResult = await parseFile('test_results/junit-web-test/expectedRetries.xml', '', false, false, true, [
'/build/',
'/__pycache__/'
])
expect(testResult).toBeDefined()
const {totalCount, skippedCount, globalAnnotations} = testResult!!
const filtered = globalAnnotations.filter(annotation => annotation.annotation_level !== 'notice')
Expand All @@ -1020,11 +1011,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
})

it('there should be two errors if retries are not handled', async () => {
const testResult = await parseFile(
'test_results/junit-web-test/expectedRetries.xml',
'',
false
)
const testResult = await parseFile('test_results/junit-web-test/expectedRetries.xml', '', false)
expect(testResult).toBeDefined()
const {totalCount, skippedCount, globalAnnotations} = testResult!!
const filtered = globalAnnotations.filter(annotation => annotation.annotation_level !== 'notice')
Expand Down Expand Up @@ -1064,13 +1051,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
})

it('merge flaky tests, and include retry count', async () => {
const testResult = await parseFile(
'test_results/junit-web-test/expectedRetries.xml',
'',
true,
true,
true,
)
const testResult = await parseFile('test_results/junit-web-test/expectedRetries.xml', '', true, true, true)
expect(testResult).toBeDefined()
const {totalCount, skippedCount, globalAnnotations} = testResult!!
const filtered = globalAnnotations.filter(annotation => annotation.retries > 0)
Expand All @@ -1095,12 +1076,7 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
})

it('flaky tests, and include retry count', async () => {
const testResult = await parseFile(
'test_results/junit_flaky_failure/marathon_junit_report.xml',
'',
true,
true
)
const testResult = await parseFile('test_results/junit_flaky_failure/marathon_junit_report.xml', '', true, true)
expect(testResult).toBeDefined()
const {totalCount, skippedCount, globalAnnotations} = testResult!!
const filtered = globalAnnotations.filter(annotation => annotation.retries > 0)
Expand All @@ -1109,17 +1085,17 @@ action.surefire.report.email.InvalidEmailAddressException: Invalid email address
expect(skippedCount).toBe(0)
expect(filtered).toStrictEqual([
{
'annotation_level': 'notice',
'end_column': 0,
'end_line': 1,
'message': 'testFlakyFailure',
'path': 'Class',
'raw_details': '',
'retries': 1,
'start_column': 0,
'start_line': 1,
'status': 'success',
'title': 'Class.testFlakyFailure'
annotation_level: 'notice',
end_column: 0,
end_line: 1,
message: 'testFlakyFailure',
path: 'Class',
raw_details: '',
retries: 1,
start_column: 0,
start_line: 1,
status: 'success',
title: 'Class.testFlakyFailure'
}
])
})
Expand Down
Loading

0 comments on commit ca9f44b

Please sign in to comment.