Check @jest-reporters/testrail plugin. It is a TestRail module for Jest. Helps to create test runs on TestRail for multiple suites and send results.
First, install the plugin
npm i @jest-reporters/testrail
Second, update jest.config.js
module.exports = {
...
reporters: [
["testrail", {
project_id: "1"
}]
]
};
Third, in your test case files
// "1:" this is Suite ID from Test Rail (Will work only for top)
describe("TestRail[1] Suite", () => {
// "11:" this is Case ID from Test Rail
it("TestRail[11] Test success", async() => {
expect(1).toBe(1);
});
it("TestRail[12] Test fail", async() => {
expect(1).toBe(0);
});
xit("TestRail[13] Test skip", async() => {
expect(1).toBe(1);
});
});
The Suite ID from TestRail must be added to the start of top describe() description, ID should be in TestRail[ID].
The Case ID from TestRail must be added to the start of each it() description, ID should be in TestRail[ID].