apex-mutation-testing
Version:
Apex mutation testing plugin
23 lines • 919 B
JavaScript
import { TestService } from '@salesforce/apex-node';
export class ApexTestRunner {
testService;
constructor(connection) {
this.testService = new TestService(connection);
}
async getCoveredLines(testClassName) {
const testResult = await this.runTestAsynchronous(testClassName, false);
return new Set(testResult.codecoverage?.flatMap(coverage => coverage.coveredLines));
}
async run(testClassName) {
return await this.runTestAsynchronous(testClassName);
}
async runTestAsynchronous(testClassName, skipCodeCoverage = true) {
return (await this.testService.runTestAsynchronous({
tests: [{ className: testClassName }],
testLevel: "RunSpecifiedTests" /* TestLevel.RunSpecifiedTests */,
skipCodeCoverage,
maxFailedTests: 0,
}, !skipCodeCoverage));
}
}
//# sourceMappingURL=apexTestRunner.js.map