'How I can get result of each test in Detox?

I want to create integration with my TMS in order to save autotests results with tests, stored in the TMS:

  1. Create test run (done by me)
  2. Add all run test cases to it (done by me)
  3. Pass results of this cases to the created test run (here is the issue)
  4. Complete run on end autotests (also done by me)

I use Detox for running tests, but didn't get how to get test result of each test. I've found Detox ArtifactPlugin.test.js, where is operations around test results shown:

class TestArtifactPlugin extends ArtifactPlugin {}

describe('ArtifactPlugin', () => {
  let api;
  let plugin;

  beforeEach(() => {
    api = {
      userConfig: {
        enabled: false,
        keepOnlyFailedTestsArtifacts: false,
      },
    };

    plugin = new TestArtifactPlugin({ api });
  });

    it('should have .onTestDone, which updates context.testSummary if called', async () => {
          const testSummary = testSummaries.failed();
          await plugin.onTestDone(testSummary);
          expect(plugin.context.testSummary).toBe(testSummary);
        });
}

I want it to be done somehow like this:

let testResults = []
let testResult = {}

afterEach(async () => {
  await testResults.push({
    testID: context.testSummary.ID,
    result: context.testSummary.result
  })
})


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source