Jest test runner integration with Jasmine 2.x framework providing BDD-style testing capabilities
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Jasmine to Jest test result reporting system that converts Jasmine's test results into Jest's standardized format.
Main reporter class that implements the Jasmine Reporter interface and converts results to Jest format.
/**
* Jasmine to Jest test result reporter
* Implements Jasmine's Reporter interface and converts results to Jest format
*/
class JasmineReporter implements Reporter {
/**
* Creates a new Jasmine reporter instance
* @param globalConfig - Jest global configuration
* @param config - Jest project configuration
* @param testPath - Path to the test file being executed
*/
constructor(
globalConfig: Config.GlobalConfig,
config: Config.ProjectConfig,
testPath: string,
);
/**
* Called when Jasmine starts running tests
* @param runDetails - Details about the test run
*/
jasmineStarted(runDetails: RunDetails): void;
/**
* Called when an individual test starts
* @param spec - The test specification that started
*/
specStarted(spec: SpecResult): void;
/**
* Called when an individual test completes
* @param result - The completed test result
*/
specDone(result: SpecResult): void;
/**
* Called when a test suite starts
* @param suite - The test suite that started
*/
suiteStarted(suite: SuiteResult): void;
/**
* Called when a test suite completes
* @param _result - The completed suite result (unused)
*/
suiteDone(_result: SuiteResult): void;
/**
* Called when all tests complete
* @param _runDetails - Details about the completed test run
*/
jasmineDone(_runDetails: RunDetails): void;
/**
* Gets the final test results in Jest format
* @returns Promise resolving to Jest TestResult
*/
getResults(): Promise<TestResult>;
}The standard Jasmine Reporter interface that defines the lifecycle hooks.
/**
* Standard Jasmine Reporter interface for test lifecycle events
*/
interface Reporter {
/** Called when all tests complete */
jasmineDone(runDetails: RunDetails): void;
/** Called when Jasmine starts running tests */
jasmineStarted(runDetails: RunDetails): void;
/** Called when an individual test completes */
specDone(result: SpecResult): void;
/** Called when an individual test starts */
specStarted(spec: SpecResult): void;
/** Called when a test suite completes */
suiteDone(result: SuiteResult): void;
/** Called when a test suite starts */
suiteStarted(result: SuiteResult): void;
}Information about test run execution provided to reporter lifecycle methods.
/**
* Details about test run execution
*/
interface RunDetails {
/** Total number of specs defined in the test run */
totalSpecsDefined?: number;
/** Failed expectations from suite-level failures */
failedExpectations?: SuiteResult['failedExpectations'];
}Individual test result information from Jasmine.
/**
* Result information for an individual test specification
*/
interface SpecResult {
/** Unique identifier for the spec */
id: string;
/** Test description/name */
description: string;
/** Full test name including suite hierarchy */
fullName: string;
/** Test execution status */
status: 'passed' | 'failed' | 'pending' | 'disabled' | 'todo';
/** Array of failed expectations with error details */
failedExpectations: Array<{
/** Actual value in failed assertion */
actual: string;
/** Expected value in failed assertion */
expected: string;
/** Matcher name that failed */
matcherName: string;
/** Error message */
message: string;
/** Whether the expectation passed */
passed: boolean;
/** Stack trace */
stack: string;
}>;
/** Call site information for test location */
__callsite?: NodeJS.CallSite;
}Test suite result information from Jasmine.
/**
* Result information for a test suite
*/
interface SuiteResult {
/** Unique identifier for the suite */
id: string;
/** Suite description/name */
description: string;
/** Full suite name including parent hierarchy */
fullName: string;
/** Suite execution status */
status: 'finished' | 'disabled';
/** Array of failed expectations at suite level */
failedExpectations: Array<{
actual: string;
expected: string;
matcherName: string;
message: string;
passed: boolean;
stack: string;
}>;
}The reporter handles conversion from Jasmine's result format to Jest's TestResult:
passed → passedfailed → failedpending/disabled → pendingtodo → todoUsage Example:
import JasmineReporter from "jest-jasmine2/build/reporter";
// Create reporter instance
const reporter = new JasmineReporter(
globalConfig,
projectConfig,
"/path/to/test.spec.js"
);
// Add to Jasmine environment
env.addReporter(reporter);
// After tests complete, get Jest-formatted results
const testResult = await reporter.getResults();
console.log(`${testResult.numPassingTests} tests passed`);