question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression: Custom reporter not working for multiple test files execution

See original GitHub issue

This seems broken since v0.9.0 release. Custom reporter works with just one test file execution but doesn’t work when executing a set of test files. This is for both approaches, --reporter and reporter method in external globals file.

I tried with v0.8.18 and it works fine for any test executions.

Its surprising that no one even reported this issue (does that mean nobody is using this feature? )

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:21 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
aberonnicommented, Sep 17, 2018

@lreading we have a workaround in place that uses the global afterEach hook. The client parameter contains a currentTest property with which we update a json.

This is a rough example (might need some readaption to work correctly).

const filePath = 'some/path/to.json';

afterEach: (client, done) => {
    const { currentTest } = client;
    let results;

    try {
        results = require(filePath);
    } catch (e) {
        results = {};
    }

    const data = {
        name: currentTest.module,
        success: currentTest.results.errors === 0 && currentTest.results.failed === 0,
        errors: Object.entries(currentTest.results.testcases).reduce((errors, [testcaseName, testcase]) => {
            if (testcase.errors !== 0 || testcase.failed !== 0) {
                errors.push({
                    testcase: testcaseName,
                    assertions: testcase.assertions
                });
            }

            return errors;
        }, [])
    };

    results[data.name] = data;

    try {
        fs.writeFileSync(filePath, JSON.stringify(results), "utf8");
    } catch (e) {
        console.log(`An error occured while saving ${filePath}:`);
        console.log(e);
    }

    done()
};
1reaction
Rajesh-Narayanappa87commented, Jan 11, 2018

+1. Able to reproduce in 0.9.19

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run regression tests — Generic Model documentation
Run regression tests¶. The Python script regression_test.py runs a suite of regression simulations and compares the output to the reference output for each ......
Read more >
How To Generate Mocha Reports With Mochawesome?
Mochawesome is a custom Mocha reporter that allows you to create standalone HTML/CSS test reports based on the execution of your Mocha test...
Read more >
Run Test Cases In Parallel & Generate Reports Using Karate ...
This tutorial explains how to perform some basic operations on the API, run test cases in parallel & generate reports with Karate Framework....
Read more >
Understanding Test Configurations in Angular - Bits and Pieces
These tests refer to the testing issues raised in the application over ... We can have multiple configuration protractor files that execute ......
Read more >
Organizing Test Suite - WebdriverIO
Try to not have too many or too few tests in one file. ... Once your tests have several spec files, you should...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found