Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed duration conversion in mocha parser #11

Merged
merged 1 commit into from
Jun 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/parsers/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const TestCase = require('../models/TestCase');
function getTestCase(rawCase) {
const test_case = new TestCase();
test_case.name = rawCase["title"];
test_case.duration = rawCase["duration"] * 1000;
test_case.duration = rawCase["duration"];
if (rawCase["state"] == "pending") {
test_case.status = 'SKIP';
}
Expand All @@ -30,7 +30,7 @@ function getTestSuite(rawSuite) {
suite.total = rawSuite["tests"].length;
suite.passed = rawSuite["passes"].length;
suite.failed = rawSuite["failures"].length;
suite.duration = rawSuite["duration"] * 1000;
suite.duration = rawSuite["duration"];
suite.skipped = rawSuite["pending"].length;
suite.status = suite.total === (suite.passed + suite.skipped) ? 'PASS' : 'FAIL';
const raw_test_cases = rawSuite.tests;
Expand Down Expand Up @@ -60,7 +60,7 @@ function getTestResult(json) {
if (skipped) {
result.skipped = skipped;
}
result.duration = (stats["duration"] || 0) * 1000;
result.duration = stats["duration"] || 0;

if (suites.length > 0) {
for (let i = 0; i < suites.length; i++) {
Expand Down
48 changes: 24 additions & 24 deletions tests/parser.mocha.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Parser - Mocha Json', () => {
errors: 0,
skipped: 0,
retried: 0,
duration: 3000,
duration: 3,
status: 'PASS',
suites: [
{
Expand All @@ -25,11 +25,11 @@ describe('Parser - Mocha Json', () => {
failed: 0,
errors: 0,
skipped: 0,
duration: 1000,
duration: 1,
status: 'PASS',
cases: [
{
duration: 1000,
duration: 1,
errors: 0,
failed: 0,
failure: "",
Expand Down Expand Up @@ -74,7 +74,7 @@ describe('Parser - Mocha Json', () => {
errors: 0,
skipped: 1,
retried: 0,
duration: 3000,
duration: 3,
status: 'PASS',
suites: [
{
Expand All @@ -85,11 +85,11 @@ describe('Parser - Mocha Json', () => {
failed: 0,
errors: 0,
skipped: 1,
duration: 1000,
duration: 1,
status: 'PASS',
cases: [
{
duration: 1000,
duration: 1,
errors: 0,
failed: 0,
failure: "",
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('Parser - Mocha Json', () => {
errors: 0,
skipped: 0,
retried: 0,
duration: 7000,
duration: 7,
status: 'FAIL',
suites: [
{
Expand All @@ -143,11 +143,11 @@ describe('Parser - Mocha Json', () => {
failed: 0,
errors: 0,
skipped: 0,
duration: 4000,
duration: 4,
status: 'PASS',
cases: [
{
duration: 3000,
duration: 3,
errors: 0,
failed: 0,
failure: "",
Expand All @@ -161,7 +161,7 @@ describe('Parser - Mocha Json', () => {
total: 0
},
{
duration: 1000,
duration: 1,
errors: 0,
failed: 0,
failure: "",
Expand All @@ -184,11 +184,11 @@ describe('Parser - Mocha Json', () => {
failed: 1,
errors: 0,
skipped: 0,
duration: 1000,
duration: 1,
status: 'FAIL',
cases: [
{
duration: 1000,
duration: 1,
errors: 0,
failed: 0,
failure: "Dummy reason",
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('Parser - Mocha Awesmome Json', () => {
errors: 0,
skipped: 0,
retried: 0,
duration: 3000,
duration: 3,
status: 'PASS',
suites: [
{
Expand All @@ -232,11 +232,11 @@ describe('Parser - Mocha Awesmome Json', () => {
failed: 0,
errors: 0,
skipped: 0,
duration: 1000,
duration: 1,
status: 'PASS',
cases: [
{
duration: 1000,
duration: 1,
errors: 0,
failed: 0,
failure: "",
Expand Down Expand Up @@ -281,7 +281,7 @@ describe('Parser - Mocha Awesmome Json', () => {
errors: 0,
skipped: 1,
retried: 0,
duration: 3000,
duration: 3,
status: 'PASS',
suites: [
{
Expand All @@ -292,11 +292,11 @@ describe('Parser - Mocha Awesmome Json', () => {
failed: 0,
errors: 0,
skipped: 1,
duration: 1000,
duration: 1,
status: 'PASS',
cases: [
{
duration: 1000,
duration: 1,
errors: 0,
failed: 0,
failure: "",
Expand Down Expand Up @@ -339,7 +339,7 @@ describe('Parser - Mocha Awesmome Json', () => {
errors: 0,
skipped: 0,
retried: 0,
duration: 7000,
duration: 7,
status: 'FAIL',
suites: [
{
Expand All @@ -350,11 +350,11 @@ describe('Parser - Mocha Awesmome Json', () => {
failed: 0,
errors: 0,
skipped: 0,
duration: 4000,
duration: 4,
status: 'PASS',
cases: [
{
duration: 3000,
duration: 3,
errors: 0,
failed: 0,
failure: "",
Expand All @@ -368,7 +368,7 @@ describe('Parser - Mocha Awesmome Json', () => {
total: 0
},
{
duration: 1000,
duration: 1,
errors: 0,
failed: 0,
failure: "",
Expand All @@ -391,11 +391,11 @@ describe('Parser - Mocha Awesmome Json', () => {
failed: 1,
errors: 0,
skipped: 0,
duration: 1000,
duration: 1,
status: 'FAIL',
cases: [
{
duration: 1000,
duration: 1,
errors: 0,
failed: 0,
failure: "Dummy reason",
Expand Down