Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/jasmine-ajax/jasmine-ajax-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ describe('RequestStub', () => {
this.RequestStub = getJasmineRequireObj().AjaxRequestStub();

jasmine.addMatchers({
toMatchRequest(a, b) {
toMatchRequest() {
return {
compare(actual): jasmine.CustomMatcherResult {
return {
Expand Down
134 changes: 29 additions & 105 deletions types/jasmine/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for Jasmine 3.10
// Type definitions for Jasmine 4.0
// Project: http://jasmine.github.io
// Definitions by: Boris Yankov <https://github.com/borisyankov>
// Theodore Brown <https://github.com/theodorejb>
Expand Down Expand Up @@ -250,13 +250,6 @@ declare namespace jasmine {
* @default null
*/
seed?: number | string | null | undefined;
/**
* Whether to stop execution of the suite after the first spec failure
* @since 3.3.0
* @default false
* @deprecated Use the `stopOnSpecFailure` config property instead.
*/
failFast?: boolean | undefined;
/**
* Whether to stop execution of the suite after the first spec failure
* @since 3.9.0
Expand All @@ -271,13 +264,6 @@ declare namespace jasmine {
* @default false
*/
failSpecWithNoExpectations?: boolean | undefined;
/**
* Whether to cause specs to only have one expectation failure.
* @since 3.3.0
* @default false
* @deprecated Use the `stopSpecOnExpectationFailure` config property instead.
*/
oneFailurePerSpec?: boolean | undefined;
/**
* Whether to cause specs to only have one expectation failure.
* @since 3.3.0
Expand Down Expand Up @@ -318,10 +304,11 @@ declare namespace jasmine {
type EnvConfiguration = Configuration;

function clock(): Clock;
/**
* @deprecated Private method that may be changed or removed in the future
*/
function DiffBuilder(): DiffBuilder;

var matchersUtil: MatchersUtil;

/**
* That will succeed if the actual value being compared is an instance of the specified class/constructor.
*/
Expand Down Expand Up @@ -374,9 +361,8 @@ declare namespace jasmine {
function createSpyObj(methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): any;
function createSpyObj<T>(methodNames: SpyObjMethodNames<T>, propertyNames?: SpyObjPropertyNames<T>): SpyObj<T>;

function pp(value: any): string;

function getEnv(): Env;
function debugLog(msg: string): void;

function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;

Expand All @@ -401,15 +387,12 @@ declare namespace jasmine {

interface Any extends AsymmetricMatcher<any> {
new (expectedClass: any): any;
jasmineToString(prettyPrint: typeof pp): string;
jasmineToString(prettyPrint: (value: any) => string): string;
}

interface AsymmetricMatcher<TValue> {
/**
* customTesters are deprecated and will be replaced with matcherUtils in the future.
*/
asymmetricMatch(other: TValue, matchersUtil?: MatchersUtil | ReadonlyArray<CustomEqualityTester>): boolean;
jasmineToString?(prettyPrint: typeof pp): string;
asymmetricMatch(other: TValue, matchersUtil?: MatchersUtil): boolean;
jasmineToString?(prettyPrint: (value: any) => string): string;
}

// taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
Expand All @@ -420,13 +403,13 @@ declare namespace jasmine {

interface ArrayContaining<T> extends AsymmetricMatcher<any> {
new?(sample: ArrayLike<T>): ArrayLike<T>;
jasmineToString(prettyPrint: typeof pp): string;
jasmineToString(prettyPrint: (value: any) => string): string;
}

interface ObjectContaining<T> extends AsymmetricMatcher<T> {
new?(sample: { [K in keyof T]?: any }): { [K in keyof T]?: any };

jasmineToString?(prettyPrint: typeof pp): string;
jasmineToString?(prettyPrint: (value: any) => string): string;
}

interface Clock {
Expand Down Expand Up @@ -456,15 +439,9 @@ declare namespace jasmine {
negativeCompare?(actual: any, ...expected: any[]): PromiseLike<CustomMatcherResult>;
}

type CustomMatcherFactory = (
util: MatchersUtil,
customEqualityTesters: ReadonlyArray<CustomEqualityTester>,
) => CustomMatcher;
type CustomMatcherFactory = (util: MatchersUtil) => CustomMatcher;

type CustomAsyncMatcherFactory = (
util: MatchersUtil,
customEqualityTesters: ReadonlyArray<CustomEqualityTester>,
) => CustomAsyncMatcher;
type CustomAsyncMatcherFactory = (util: MatchersUtil) => CustomAsyncMatcher;

interface CustomMatcherFactories {
[name: string]: CustomMatcherFactory;
Expand All @@ -479,6 +456,9 @@ declare namespace jasmine {
message?: string | undefined;
}

/**
* @deprecated Private type that may be changed or removed in the future
*/
interface DiffBuilder {
setRoots(actual: any, expected: any): void;
recordMismatch(formatter?: (actual: any, expected: any, path?: any, prettyPrinter?: any) => string): void;
Expand All @@ -487,12 +467,14 @@ declare namespace jasmine {
}

interface MatchersUtil {
equals(a: any, b: any, customTesters?: ReadonlyArray<CustomEqualityTester>, diffBuilder?: DiffBuilder): boolean;
equals(a: any, b: any): boolean;
contains<T>(
haystack: ArrayLike<T> | string,
needle: any,
customTesters?: ReadonlyArray<CustomEqualityTester>,
needle: any
): boolean;
/**
* @deprecated Private method that may be changed or removed in the future
*/
buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: any[]): string;

/**
Expand All @@ -503,7 +485,7 @@ declare namespace jasmine {
* @param value The value to pretty-print
* @return The pretty-printed value
*/
pp: typeof pp;
pp(value: any): string;
}

interface Env {
Expand All @@ -514,28 +496,8 @@ declare namespace jasmine {
configure(configuration: Configuration): void;
execute(runnablesToRun: Suite[] | null | undefined, onComplete: Func): void;
/** @async */
execute(runnablesToRun?: Suite[]): PromiseLike<void>;
/**
* @deprecated Use hideDisabled option in {@link jasmine.Env.configure} instead.
*/
hideDisabled(value: boolean): void;
/**
* @deprecated Check hideDisabled option in {@link jasmine.Env.configuration} instead.
*/
hidingDisabled(): boolean;
execute(runnablesToRun?: Suite[]): PromiseLike<JasmineDoneInfo>;
provideFallbackReporter(reporter: CustomReporter): void;
/**
* @deprecated Check random option in {@link jasmine.Env.configuration} instead.
*/
randomTests(): boolean;
/**
* @deprecated Use random option in {@link jasmine.Env.configure} instead.
*/
randomizeTests(value: boolean): void;
/**
* @deprecated Use seed option in {@link jasmine.Env.configure} instead.
*/
seed(value?: number | string): number | string;
/**
* Sets a user-defined property that will be provided to reporters as
* part of the properties field of SpecResult.
Expand All @@ -548,26 +510,6 @@ declare namespace jasmine {
* @since 3.6.0
*/
setSuiteProperty: typeof setSuiteProperty;
/**
* @deprecated Use specFilter option in {@link jasmine.Env.configure} instead.
*/
specFilter(spec: Spec): boolean;
/**
* @deprecated Use failFast option in {@link jasmine.Env.configure} instead.
*/
stopOnSpecFailure(value: boolean): void;
/**
* @deprecated Check failFast option in {@link jasmine.Env.configuration} instead.
*/
stoppingOnSpecFailure(): boolean;
/**
* @deprecated Use oneFailurePerSpec option in {@link jasmine.Env.configure} instead.
*/
throwOnExpectationFailure(value: boolean): void;
/**
* @deprecated Check oneFailurePerSpec option in {@link jasmine.Env.configuration} instead.
*/
throwingExpectationFailures(): boolean;
topSuite(): Suite;
}

Expand Down Expand Up @@ -1015,6 +957,13 @@ declare namespace jasmine {
* If the spec is pending, this will be the reason.
*/
pendingReason: string;

debugLogs: DebugLogEntry[] | null;
}

interface DebugLogEntry {
message: String;
timestamp: number;
}

interface JasmineDoneInfo {
Expand Down Expand Up @@ -1289,10 +1238,6 @@ declare module "jasmine" {
* @deprecated Private property that may be changed or removed in the future
*/
reportersCount: number;
/**
* @deprecated Private property that may be changed or removed in the future
*/
completionReporter: jasmine.CustomReporter;
/**
* @deprecated Private property that may be changed or removed in the future
*/
Expand Down Expand Up @@ -1321,10 +1266,6 @@ declare module "jasmine" {
* @deprecated Private property that may be changed or removed in the future
*/
requires: string[];
/**
* @deprecated Private property that may be changed or removed in the future
*/
onCompleteCallbackAdded: boolean;
/**
* @deprecated Private property that may be changed or removed in the future
*/
Expand All @@ -1340,16 +1281,8 @@ declare module "jasmine" {
* Adds a spec file to the list that will be loaded when the suite is executed.
*/
addSpecFile(filePath: string): void;
/**
* @deprecated Use addMatchingSpecFiles, loadConfig, or loadConfigFile instead
*/
addSpecFiles(files: string[]): void;
addMatchingSpecFiles(patterns: string[]): void;
addHelperFile(filePath: string): void;
/**
* @deprecated Use addMatchingHelperFiles, loadConfig, or loadConfigFile instead
*/
addHelperFiles(files: string[]): void;
addMatchingHelperFiles(patterns: string[]): void;
/**
* @deprecated Private method that may be changed or removed in the future
Expand All @@ -1360,10 +1293,6 @@ declare module "jasmine" {
*/
configureDefaultReporter(options: jasmine.DefaultReporterOptions): void;
execute(files?: string[], filterString?: string): Promise<jasmine.JasmineDoneInfo>;
/**
* @deprecated Private property that may be changed or removed in the future
*/
exitCodeCompletion(passed: boolean): void;
exitOnCompletion: boolean;
loadConfig(config: jasmine.JasmineConfig): void;
loadConfigFile(configFilePath?: string): void;
Expand All @@ -1380,11 +1309,6 @@ declare module "jasmine" {
*/
loadRequires(): void;

/**
* @deprecated set exitOnCompletion to false and use the promise returned
* from execute() instead.
*/
onComplete(onCompleteCallback: (passed: boolean) => void): void;
/**
* Provide a fallback reporter if no other reporters have been specified.
*/
Expand Down
Loading