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
The main test runner function that executes Jasmine tests within Jest's environment, handling configuration, setup, and result reporting.
The primary export that orchestrates test execution by integrating Jest configuration with Jasmine's test framework.
/**
* Main test runner function that executes Jasmine tests within Jest environment
* @param globalConfig - Jest global configuration
* @param config - Jest project-specific configuration
* @param environment - Jest test environment (jsdom, node, etc.)
* @param runtime - Jest runtime instance for module resolution and execution
* @param testPath - Absolute path to the test file being executed
* @returns Promise resolving to Jest TestResult
*/
function jasmine2(
globalConfig: Config.GlobalConfig,
config: Config.ProjectConfig,
environment: JestEnvironment,
runtime: Runtime,
testPath: string,
): Promise<TestResult>;Usage Example:
import jasmine2 from "jest-jasmine2";
// Typically called by Jest's test runner infrastructure
const testResult = await jasmine2(
globalConfig,
projectConfig,
testEnvironment,
jestRuntime,
"/path/to/test.spec.js"
);
console.log(`Tests: ${testResult.numPassingTests} passed, ${testResult.numFailingTests} failed`);The function returns Jest's standardized TestResult format with complete test execution information.
interface TestResult {
console?: ConsoleBuffer;
coverage?: CoverageMapData;
displayName?: Config.DisplayName;
failureMessage?: string | null;
leaks: boolean;
memoryUsage?: Bytes;
numFailingTests: number;
numPassingTests: number;
numPendingTests: number;
numTodoTests: number;
openHandles: Array<Error>;
perfStats: {
end: Milliseconds;
runtime: Milliseconds;
slow: boolean;
start: Milliseconds;
};
skipped: boolean;
snapshot: {
added: number;
fileDeleted: boolean;
matched: number;
unchecked: number;
uncheckedKeys: Array<string>;
unmatched: number;
updated: number;
};
sourceMaps: {[sourcePath: string]: string};
testExecError?: SerializableError;
testFilePath: string;
testResults: Array<AssertionResult>;
}The test runner follows this execution sequence:
The test runner integrates with Jest's configuration system:
testTimeout: Default timeout for test functionsmaxConcurrency: Maximum concurrent tests for it.concurrentexpand: Expand diff output in test resultstestNamePattern: Filter tests by name patternerrorOnDeprecated: Throw errors on deprecated Jasmine APIstestLocationInResults: Include test location in resultsfakeTimers.enableGlobally: Enable fake timers globallyfakeTimers.legacyFakeTimers: Use legacy fake timer implementationresetModules: Reset module registry between testsclearMocks/resetMocks/restoreMocks: Mock management settingssetupFilesAfterEnv: Setup files to run after environment setupsnapshotSerializers: Custom snapshot serializersUsage Example:
// Jest configuration affecting jest-jasmine2 behavior
module.exports = {
testRunner: "jest-jasmine2",
testTimeout: 10000,
testEnvironment: "node",
setupFilesAfterEnv: ["<rootDir>/setup-tests.js"],
fakeTimers: {
enableGlobally: true,
legacyFakeTimers: false
}
};