mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge remote-tracking branch 'upstream/master' into jquery-countto
This commit is contained in:
@@ -5,8 +5,8 @@ var mongoConnectionString = "mongodb://127.0.0.1/agenda";
|
||||
|
||||
var agenda = new Agenda({ db: { address: mongoConnectionString } });
|
||||
|
||||
agenda.define('delete old users', (job, done) => {
|
||||
|
||||
agenda.define<{ foo: Error }>('delete old users', (job, done) => {
|
||||
done(job.attrs.data.foo)
|
||||
});
|
||||
|
||||
agenda.on('ready', () => {
|
||||
@@ -62,7 +62,7 @@ agenda.schedule('tomorrow at noon', ['printAnalyticsReport', 'sendNotifications'
|
||||
|
||||
agenda.now('do the hokey pokey');
|
||||
|
||||
var job = agenda.create('printAnalyticsReport', { userCount: 100 });
|
||||
var job = agenda.create<{ userCount: number }>('printAnalyticsReport', { userCount: 100 });
|
||||
job.save(function(err) {
|
||||
console.log("Job successfully saved");
|
||||
});
|
||||
|
||||
Vendored
+31
-26
@@ -1,6 +1,7 @@
|
||||
// Type definitions for Agenda v1.0.0
|
||||
// Project: https://github.com/rschmukler/agenda
|
||||
// Type definitions for Agenda v1.0.3
|
||||
// Project: https://github.com/agenda/agenda
|
||||
// Definitions by: Meir Gottlieb <https://github.com/meirgottlieb>
|
||||
// Jeff Principe <https://github.com/princjef>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -89,14 +90,14 @@ declare class Agenda extends EventEmitter {
|
||||
* @param name The name of the job.
|
||||
* @param data Data to associated with the job.
|
||||
*/
|
||||
create(name: string, data?: any): Agenda.Job;
|
||||
create<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, data?: T): Agenda.Job<T>;
|
||||
|
||||
/**
|
||||
* Find all Jobs matching `query` and pass same back in cb().
|
||||
* @param query
|
||||
* @param cb
|
||||
*/
|
||||
jobs(query: any, cb: ResultCallback<Agenda.Job[]>): void;
|
||||
jobs<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(query: any, cb: ResultCallback<Agenda.Job<T>[]>): void;
|
||||
|
||||
/**
|
||||
* Removes all jobs in the database without defined behaviors. Useful if you change a definition name and want
|
||||
@@ -113,8 +114,8 @@ declare class Agenda extends EventEmitter {
|
||||
* @param options The options for the job.
|
||||
* @param handler The handler to execute.
|
||||
*/
|
||||
define(name: string, handler: (job: Agenda.Job, done: (err?: Error) => void) => void): void;
|
||||
define(name: string, options: Agenda.JobOptions, handler: (job: Agenda.Job, done: (err?: Error) => void) => void): void;
|
||||
define<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, handler: (job: Agenda.Job<T>, done: (err?: Error) => void) => void): void;
|
||||
define<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, options: Agenda.JobOptions, handler: (job: Agenda.Job<T>, done: (err?: Error) => void) => void): void;
|
||||
|
||||
/**
|
||||
* Runs job name at the given interval. Optionally, data and options can be passed in.
|
||||
@@ -124,8 +125,8 @@ declare class Agenda extends EventEmitter {
|
||||
* @param options An optional argument that will be passed to job.repeatEvery.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
every(interval: number | string, names: string, data?: any, options?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
|
||||
every(interval: number | string, names: string[], data?: any, options?: any, cb?: ResultCallback<Agenda.Job[]>): Agenda.Job[];
|
||||
every<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(interval: number | string, names: string, data?: T, options?: any, cb?: ResultCallback<Agenda.Job<T>>): Agenda.Job<T>;
|
||||
every<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(interval: number | string, names: string[], data?: T, options?: any, cb?: ResultCallback<Agenda.Job<T>[]>): Agenda.Job<T>[];
|
||||
|
||||
/**
|
||||
* Schedules a job to run name once at a given time.
|
||||
@@ -134,8 +135,8 @@ declare class Agenda extends EventEmitter {
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
schedule(when: Date | string, names: string, data?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
|
||||
schedule(when: Date | string, names: string[], data?: any, cb?: ResultCallback<Agenda.Job[]>): Agenda.Job[];
|
||||
schedule<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(when: Date | string, names: string, data?: T, cb?: ResultCallback<Agenda.Job<T>>): Agenda.Job<T>;
|
||||
schedule<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(when: Date | string, names: string[], data?: T, cb?: ResultCallback<Agenda.Job<T>[]>): Agenda.Job<T>[];
|
||||
|
||||
/**
|
||||
* Schedules a job to run name once immediately.
|
||||
@@ -143,7 +144,7 @@ declare class Agenda extends EventEmitter {
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
now(name: string, data?: any, cb?: ResultCallback<Agenda.Job>): Agenda.Job;
|
||||
now<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(name: string, data?: T, cb?: ResultCallback<Agenda.Job<T>>): Agenda.Job<T>;
|
||||
|
||||
/**
|
||||
* Cancels any jobs matching the passed mongodb-native query, and removes them from the database.
|
||||
@@ -242,10 +243,14 @@ declare namespace Agenda {
|
||||
}
|
||||
}
|
||||
|
||||
interface JobAttributesData {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* The database record associated with a job.
|
||||
*/
|
||||
interface JobAttributes {
|
||||
interface JobAttributes<T extends JobAttributesData = JobAttributesData> {
|
||||
/**
|
||||
* The record identity.
|
||||
*/
|
||||
@@ -264,7 +269,7 @@ declare namespace Agenda {
|
||||
/**
|
||||
* The job details.
|
||||
*/
|
||||
data: { [name: string]: any };
|
||||
data: T;
|
||||
|
||||
/**
|
||||
* The priority of the job.
|
||||
@@ -330,12 +335,12 @@ declare namespace Agenda {
|
||||
/**
|
||||
* A scheduled job.
|
||||
*/
|
||||
interface Job {
|
||||
interface Job<T extends JobAttributesData = JobAttributesData> {
|
||||
|
||||
/**
|
||||
* The database record associated with the job.
|
||||
*/
|
||||
attrs: JobAttributes;
|
||||
attrs: JobAttributes<T>;
|
||||
|
||||
/**
|
||||
* The agenda that created the job.
|
||||
@@ -348,54 +353,54 @@ declare namespace Agenda {
|
||||
* @param options An optional argument that can include a timezone field. The timezone should be a string as
|
||||
* accepted by moment-timezone and is considered when using an interval in the cron string format.
|
||||
*/
|
||||
repeatEvery(interval: string | number, options?: { timezone?: string }): Job
|
||||
repeatEvery(interval: string | number, options?: { timezone?: string }): Job<T>
|
||||
|
||||
/**
|
||||
* Specifies a time when the job should repeat. [Possible values](https://github.com/matthewmueller/date#examples).
|
||||
* @param time
|
||||
*/
|
||||
repeatAt(time: string): Job
|
||||
repeatAt(time: string): Job<T>
|
||||
|
||||
/**
|
||||
* Disables the job.
|
||||
*/
|
||||
disable(): Job;
|
||||
disable(): Job<T>;
|
||||
|
||||
/**
|
||||
* Enables the job.
|
||||
*/
|
||||
enable(): Job;
|
||||
enable(): Job<T>;
|
||||
|
||||
/**
|
||||
* Ensure that only one instance of this job exists with the specified properties
|
||||
* @param value The properties associated with the job that must be unqiue.
|
||||
* @param opts
|
||||
*/
|
||||
unique(value: any, opts?: { insertOnly?: boolean }): Job;
|
||||
unique(value: any, opts?: { insertOnly?: boolean }): Job<T>;
|
||||
|
||||
/**
|
||||
* Specifies the next time at which the job should run.
|
||||
* @param time The next time at which the job should run.
|
||||
*/
|
||||
schedule(time: string | Date): Job;
|
||||
schedule(time: string | Date): Job<T>;
|
||||
|
||||
/**
|
||||
* Specifies the priority weighting of the job.
|
||||
* @param value The priority of the job (lowest|low|normal|high|highest|number).
|
||||
*/
|
||||
priority(value: string | number): Job;
|
||||
priority(value: string | number): Job<T>;
|
||||
|
||||
/**
|
||||
* Sets job.attrs.failedAt to now, and sets job.attrs.failReason to reason.
|
||||
* @param reason A message or Error object that indicates why the job failed.
|
||||
*/
|
||||
fail(reason: string | Error): Job;
|
||||
fail(reason: string | Error): Job<T>;
|
||||
|
||||
/**
|
||||
* Runs the given job and calls callback(err, job) upon completion. Normally you never need to call this manually
|
||||
* @param cb Called when the job is completed.
|
||||
*/
|
||||
run(cb?: ResultCallback<Job>): Job;
|
||||
run(cb?: ResultCallback<Job<T>>): Job<T>;
|
||||
|
||||
/**
|
||||
* Returns true if the job is running; otherwise, returns false.
|
||||
@@ -406,7 +411,7 @@ declare namespace Agenda {
|
||||
* Saves the job into the database.
|
||||
* @param cb Called when the job is saved.
|
||||
*/
|
||||
save(cb?: ResultCallback<Job>): Job;
|
||||
save(cb?: ResultCallback<Job<T>>): Job<T>;
|
||||
|
||||
/**
|
||||
* Removes the job from the database and cancels the job.
|
||||
@@ -424,7 +429,7 @@ declare namespace Agenda {
|
||||
/**
|
||||
* Calculates next time the job should run
|
||||
*/
|
||||
computeNextRunAt(): Job;
|
||||
computeNextRunAt(): Job<T>;
|
||||
}
|
||||
|
||||
interface JobOptions {
|
||||
|
||||
Vendored
+3
-3
@@ -25,7 +25,7 @@ declare namespace autobahn {
|
||||
|
||||
leave(reason: string, message: string): void;
|
||||
|
||||
call<TResult>(procedure: string, args?: any[], kwargs?: any, options?: ICallOptions): When.Promise<TResult>;
|
||||
call<TResult>(procedure: string, args?: any[] | any, kwargs?: any, options?: ICallOptions): When.Promise<TResult>;
|
||||
|
||||
publish(topic: string, args?: any[], kwargs?: any, options?: IPublishOptions): When.Promise<IPublication>;
|
||||
|
||||
@@ -96,7 +96,7 @@ declare namespace autobahn {
|
||||
kwargs: any;
|
||||
}
|
||||
|
||||
type SubscribeHandler = (args?: any[], kwargs?: any, details?: IEvent) => void;
|
||||
type SubscribeHandler = (args?: any[] | any, kwargs?: any, details?: IEvent) => void;
|
||||
|
||||
interface ISubscription {
|
||||
topic: string;
|
||||
@@ -206,7 +206,7 @@ declare namespace autobahn {
|
||||
|
||||
type DeferFactory = () => When.Promise<any>;
|
||||
|
||||
type OnChallengeHandler = (session: Session, method: string, extra: any) => string;
|
||||
type OnChallengeHandler = (session: Session, method: string, extra: any) => string | When.Promise<string>;
|
||||
|
||||
interface IConnectionOptions {
|
||||
use_es6_promises?: boolean;
|
||||
|
||||
Vendored
+128
-25
@@ -1,6 +1,7 @@
|
||||
// Type definitions for cassandra-driver v3.2.2
|
||||
// Type definitions for cassandra-driver v3.4.1
|
||||
// Project: https://github.com/datastax/nodejs-driver
|
||||
// Definitions by: Marc Fisher <https://github.com/Svjard>
|
||||
// Christian D <https://github.com/pc-jedi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -115,7 +116,11 @@ export namespace policies {
|
||||
interface RetryPolicyStatic {
|
||||
new (): RetryPolicy;
|
||||
|
||||
retryDecision: any;
|
||||
retryDecision: {
|
||||
rethrow: number,
|
||||
retry: number,
|
||||
ignore: number
|
||||
};
|
||||
}
|
||||
|
||||
interface RetryPolicy {
|
||||
@@ -126,15 +131,55 @@ export namespace policies {
|
||||
retryResult(): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean };
|
||||
}
|
||||
}
|
||||
|
||||
namespace speculativeExecution {
|
||||
let NoSpeculativeExecutionPolicy: NoSpeculativeExecutionPolicyStatic
|
||||
|
||||
interface SpeculativeExecutionPolicy {
|
||||
init(client: Client): void;
|
||||
newPlan(keyspace: string, queryInfo: string | Array<string>): {
|
||||
nextExecution: Function
|
||||
}
|
||||
}
|
||||
|
||||
interface NoSpeculativeExecutionPolicyStatic {
|
||||
new (): NoSpeculativeExecutionPolicy
|
||||
}
|
||||
|
||||
interface NoSpeculativeExecutionPolicy extends SpeculativeExecutionPolicy { }
|
||||
|
||||
interface ConstantSpeculativeExecutionPolicyStatic {
|
||||
new (delay: number, maxSpeculativeExecutions: number): ConstantSpeculativeExecutionPolicy
|
||||
}
|
||||
|
||||
interface ConstantSpeculativeExecutionPolicy extends SpeculativeExecutionPolicy { }
|
||||
}
|
||||
|
||||
namespace timestampGeneration {
|
||||
let MonotonicTimestampGenerator: MonotonicTimestampGeneratorStatic
|
||||
|
||||
interface TimestampGenerator {
|
||||
next(client: Client): null | number | _Long
|
||||
}
|
||||
|
||||
interface MonotonicTimestampGeneratorStatic {
|
||||
new (warningThreshold?: number, minLogInterval?: number): MonotonicTimestampGeneratorStatic
|
||||
}
|
||||
|
||||
interface MonotonicTimestampGenerator extends TimestampGenerator {
|
||||
getDate(): number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export namespace types {
|
||||
let BigDecimal: BigDecimalStatic;
|
||||
let Duration: DurationStatic;
|
||||
let Long: _Long;
|
||||
let InetAddress: InetAddressStatic;
|
||||
let Integer: IntegerStatic;
|
||||
let LocalDate: LocalDateStatic;
|
||||
let LocalTime: LocalTimeStatic;
|
||||
let Long: _Long;
|
||||
let ResultSet: ResultSetStatic;
|
||||
// let ResultStream: ResultStreamStatic;
|
||||
let Row: RowStatic;
|
||||
@@ -221,6 +266,19 @@ export namespace types {
|
||||
toJSON(): string;
|
||||
}
|
||||
|
||||
interface DurationStatic {
|
||||
new (month: number, days: number, nanoseconds: number | _Long): Duration;
|
||||
|
||||
fromBuffer(buffer: Buffer): Duration;
|
||||
fromString(input: string): Duration;
|
||||
}
|
||||
|
||||
interface Duration {
|
||||
equals(other: Duration): boolean;
|
||||
toBuffer(): Buffer;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
interface InetAddressStatic {
|
||||
new (buffer: Buffer): InetAddress;
|
||||
|
||||
@@ -336,13 +394,14 @@ export namespace types {
|
||||
}
|
||||
|
||||
interface ResultSetStatic {
|
||||
new (response: any, host: string, triedHost: { [key: string]: any }, consistency: consistencies): ResultSet;
|
||||
new (response: any, host: string, triedHost: { [key: string]: any }, speculativeExecutions: number, consistency: consistencies): ResultSet;
|
||||
}
|
||||
|
||||
interface ResultSet {
|
||||
info: {
|
||||
queriedHost: Host,
|
||||
triedHosts: { [key: string]: string; },
|
||||
speculativeExecutions: number,
|
||||
achievedConsistency: consistencies,
|
||||
traceId: Uuid,
|
||||
warnings: Array<string>,
|
||||
@@ -352,11 +411,13 @@ export namespace types {
|
||||
rowLength: number;
|
||||
columns: Array<{ [key: string]: string; }>;
|
||||
pageState: string;
|
||||
nextPage: any; // function
|
||||
nextPage: Function;
|
||||
|
||||
first(): Row;
|
||||
getPageState(): string;
|
||||
getColumns(): Array<{ [key: string]: string; }>;
|
||||
wasApplied(): boolean;
|
||||
[Symbol.iterator](): Iterator<Row>;
|
||||
}
|
||||
|
||||
interface ResultStreamStatic {
|
||||
@@ -442,40 +503,50 @@ export let Encoder: EncoderStatic;
|
||||
export interface ClientOptions {
|
||||
contactPoints: Array<string>,
|
||||
keyspace?: string,
|
||||
refreshSchemaDelay?: number,
|
||||
isMetadataSyncEnabled?: boolean,
|
||||
prepareOnAllHosts?: boolean,
|
||||
rePrepareOnUp?: boolean,
|
||||
maxPrepared?: number,
|
||||
policies?: {
|
||||
addressResolution?: policies.addressResolution.AddressTranslator,
|
||||
loadBalancing?: policies.loadBalancing.LoadBalancingPolicy,
|
||||
retry?: policies.retry.RetryPolicy,
|
||||
reconnection?: policies.reconnection.ReconnectionPolicy,
|
||||
retry?: policies.retry.RetryPolicy
|
||||
addressResolution?: policies.addressResolution.AddressTranslator,
|
||||
speculativeExecution?: policies.speculativeExecution.SpeculativeExecutionPolicy,
|
||||
timestampGeneration?: policies.timestampGeneration.TimestampGenerator,
|
||||
},
|
||||
queryOptions?: QueryOptions,
|
||||
pooling?: {
|
||||
heartBeatInterval: number,
|
||||
coreConnectionsPerHost: { [key: number]: number; },
|
||||
warmup: boolean;
|
||||
heartBeatInterval?: number,
|
||||
coreConnectionsPerHost?: { [key: number]: number; },
|
||||
maxRequestsPerConnection?: number,
|
||||
warmup?: boolean;
|
||||
},
|
||||
protocolOptions?: {
|
||||
port: number,
|
||||
maxSchemaAgreementWaitSeconds: number,
|
||||
maxVersion: number
|
||||
port?: number,
|
||||
maxSchemaAgreementWaitSeconds?: number,
|
||||
maxVersion?: number
|
||||
},
|
||||
socketOptions?: {
|
||||
connectTimeout: number,
|
||||
defunctReadTimeoutThreshold: number,
|
||||
keepAlive: boolean,
|
||||
keepAliveDelay: number,
|
||||
readTimeout: number,
|
||||
tcpNoDelay: boolean,
|
||||
coalescingThreshold: number
|
||||
connectTimeout?: number,
|
||||
defunctReadTimeoutThreshold?: number,
|
||||
keepAlive?: boolean,
|
||||
keepAliveDelay?: number,
|
||||
readTimeout?: number,
|
||||
tcpNoDelay?: boolean,
|
||||
coalescingThreshold?: number
|
||||
},
|
||||
authProvider?: auth.AuthProvider,
|
||||
sslOptions?: tls.ConnectionOptions,
|
||||
encoding?: {
|
||||
map: Function,
|
||||
set: Function,
|
||||
copyBuffer: boolean,
|
||||
useUndefinedAsUnset: boolean
|
||||
}
|
||||
map?: Function,
|
||||
set?: Function,
|
||||
copyBuffer?: boolean,
|
||||
useUndefinedAsUnset?: boolean
|
||||
},
|
||||
profiles?: Array<ExecutionProfile>,
|
||||
promiseFactory?: Function,
|
||||
}
|
||||
|
||||
export interface QueryOptions {
|
||||
@@ -483,8 +554,11 @@ export interface QueryOptions {
|
||||
captureStackTrace?: boolean;
|
||||
consistency?: number;
|
||||
customPayload?: any;
|
||||
executionProfile?: string | ExecutionProfile;
|
||||
fetchSize?: number;
|
||||
hints?: Array<string> | Array<Array<string>>;
|
||||
isIdempotent?: boolean;
|
||||
keyspace?: string;
|
||||
logged?: boolean;
|
||||
pageState?: Buffer | string;
|
||||
prepare?: boolean;
|
||||
@@ -520,6 +594,7 @@ export interface Client extends events.EventEmitter {
|
||||
execute(query: string, callback: ResultCallback): void;
|
||||
execute(query: string, params?: any, options?: QueryOptions): Promise<types.ResultSet>;
|
||||
getReplicas(keyspace: string, token: Buffer): Array<any>; // TODO: Should this be a more explicit return?
|
||||
getState(): metadata.ClientState;
|
||||
shutdown(callback?: Callback): void;
|
||||
shutdown(): Promise<void>;
|
||||
stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): NodeJS.ReadableStream;
|
||||
@@ -548,6 +623,7 @@ export interface HostMapStatic {
|
||||
export interface HostMap extends events.EventEmitter {
|
||||
length: number;
|
||||
|
||||
clear(): Array<Host>;
|
||||
forEach(callback: Callback): void;
|
||||
get(key: string): Host;
|
||||
keys(): Array<string>;
|
||||
@@ -566,6 +642,22 @@ export interface Encoder {
|
||||
encode(value: any, typeInfo?: string | number | { code: number, info?: any }): Buffer;
|
||||
}
|
||||
|
||||
interface ExecutionProfileOptions {
|
||||
consistency: number,
|
||||
loadBalancing: policies.loadBalancing.LoadBalancingPolicy,
|
||||
name: string,
|
||||
readTimeout: number,
|
||||
retry: policies.retry.RetryPolicy,
|
||||
serialConsistency: number
|
||||
}
|
||||
|
||||
export interface ExecutionProfileStatic {
|
||||
new (name: string, options: ExecutionProfileOptions): ExecutionProfile
|
||||
}
|
||||
|
||||
export interface ExecutionProfile extends ExecutionProfileOptions {
|
||||
}
|
||||
|
||||
export namespace auth {
|
||||
let Authenticator: AuthenticatorStatic;
|
||||
let PlainTextAuthProvider: PlainTextAuthProviderStatic;
|
||||
@@ -649,6 +741,17 @@ export namespace metadata {
|
||||
stateFunction: string;
|
||||
stateType: string;
|
||||
}
|
||||
|
||||
interface ClientStateStatic {
|
||||
new (): ClientState;
|
||||
}
|
||||
|
||||
interface ClientState {
|
||||
getConnectedHosts(): Array<Host>;
|
||||
getInFlightQueries(host: Host): number;
|
||||
getOpenConnections(host: Host): number;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
interface DataTypeInfo {
|
||||
code: number,
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { ElementHandle, Page } from "puppeteer";
|
||||
|
||||
const testGlobal = async (instance: ElementHandle | Page) => {
|
||||
await expect(instance).toClick("selector");
|
||||
await expect(instance).toClick("selector", { polling: "mutation", text: "text" });
|
||||
await expect(instance).toClick("selector", { polling: "raf", timeout: 777 });
|
||||
|
||||
await expect(instance).toDisplayDialog(async () => {});
|
||||
|
||||
await expect(instance).toFill("selector", "value");
|
||||
await expect(instance).toFill("selector", "value", { polling: 777 });
|
||||
|
||||
await expect(instance).toMatchElement("selector", "value");
|
||||
await expect(instance).toMatchElement("selector", "value", { polling: "mutation" });
|
||||
|
||||
await expect(instance).toSelect("selector", "valueOrText");
|
||||
await expect(instance).toSelect("selector", "valueOrText", { polling: "raf" });
|
||||
|
||||
await expect(instance).toUploadFile("selector", "filePath");
|
||||
await expect(instance).toUploadFile("selector", "filePath", { timeout: 777 });
|
||||
};
|
||||
|
||||
const testImported = async (instance: ElementHandle | Page) => {
|
||||
const expectPuppeteer = await import("expect-puppeteer");
|
||||
|
||||
await expectPuppeteer(instance).toClick("selector");
|
||||
await expect(instance).toClick("selector", { polling: "mutation", text: "text" });
|
||||
await expect(instance).toClick("selector", { polling: "raf", timeout: 777 });
|
||||
};
|
||||
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
// Type definitions for expect-puppeteer 2.2
|
||||
// Project: https://github.com/smooth-code/jest-puppeteer/tree/master/packages/expect-puppeteer
|
||||
// Definitions by: Josh Goldberg <https://github.com/JoshuaKGoldberg>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="jest" />
|
||||
|
||||
import { ElementHandle, Page } from "puppeteer";
|
||||
|
||||
/**
|
||||
* Interval at which pageFunctions may be executed.
|
||||
*/
|
||||
type ExpectPolling = number | "mutation" | "raf";
|
||||
|
||||
/**
|
||||
* Configures how to poll for an element.
|
||||
*/
|
||||
interface ExpectTimingActions {
|
||||
/**
|
||||
* An interval at which the pageFunction is executed. Defaults to "raf".
|
||||
*/
|
||||
polling?: ExpectPolling;
|
||||
|
||||
/**
|
||||
* Maximum time to wait for in milliseconds. Defaults to 500.
|
||||
*/
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
interface ExpectToClickOptions extends ExpectTimingActions {
|
||||
/**
|
||||
* A text or a RegExp to match in element textContent.
|
||||
*/
|
||||
text?: string | RegExp;
|
||||
}
|
||||
|
||||
interface ExpectPuppeteer {
|
||||
toClick(selector: string, options?: ExpectToClickOptions): Promise<void>;
|
||||
toDisplayDialog(block: () => Promise<void>): Promise<void>;
|
||||
toFill(selector: string, value: string, options?: ExpectTimingActions): Promise<void>;
|
||||
toMatchElement(selector: string, value: string, options?: ExpectTimingActions): Promise<void>;
|
||||
toSelect(selector: string, valueOrText: string, options?: ExpectTimingActions): Promise<void>;
|
||||
toUploadFile(selector: string, filePath: string, options?: ExpectTimingActions): Promise<void>;
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace jest {
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
interface Matchers<R> extends ExpectPuppeteer { }
|
||||
}
|
||||
}
|
||||
|
||||
declare function expectPuppeteer(instance: ElementHandle | Page): ExpectPuppeteer;
|
||||
export = expectPuppeteer;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"expect-puppeteer-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for jest-environment-puppeteer 2.2
|
||||
// Project: https://github.com/smooth-code/jest-puppeteer/tree/master/packages/jest-environment-puppeteer
|
||||
// Definitions by: Josh Goldberg <https://github.com/joshuakgoldberg>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Browser, Page } from "puppeteer";
|
||||
|
||||
declare global {
|
||||
const browser: Browser;
|
||||
const page: Page;
|
||||
}
|
||||
|
||||
export { };
|
||||
@@ -0,0 +1,4 @@
|
||||
import * as puppeteer from "puppeteer";
|
||||
|
||||
const myBrowser: puppeteer.Browser = browser;
|
||||
const myPage: puppeteer.Page = page;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jest-environment-puppeteer-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+3
-2
@@ -21,6 +21,7 @@ import * as accepts from "accepts";
|
||||
import * as Cookies from "cookies";
|
||||
import { EventEmitter } from "events";
|
||||
import { IncomingMessage, ServerResponse, Server } from "http";
|
||||
import { Http2ServerRequest, Http2ServerResponse } from 'http2';
|
||||
import httpAssert = require("http-assert");
|
||||
import * as Keygrip from "keygrip";
|
||||
import * as compose from "koa-compose";
|
||||
@@ -500,9 +501,9 @@ declare class Application extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Return a request handler callback
|
||||
* for node's native http server.
|
||||
* for node's native http/http2 server.
|
||||
*/
|
||||
callback(): (req: IncomingMessage, res: ServerResponse) => void;
|
||||
callback(): (req: IncomingMessage | Http2ServerRequest, res: ServerResponse | Http2ServerResponse) => void;
|
||||
|
||||
/**
|
||||
* Initialize a new context.
|
||||
|
||||
Vendored
+5
-1
@@ -280,7 +280,11 @@ export interface NavigationStackViewConfig {
|
||||
mode?: 'card' | 'modal';
|
||||
headerMode?: HeaderMode;
|
||||
cardStyle?: StyleProp<ViewStyle>;
|
||||
transitionConfig?: () => TransitionConfig;
|
||||
transitionConfig?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps: NavigationTransitionProps,
|
||||
isModal: boolean,
|
||||
) => TransitionConfig;
|
||||
onTransitionStart?: () => void;
|
||||
onTransitionEnd?: () => void;
|
||||
}
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ export interface PropTypes {
|
||||
name?: string;
|
||||
placeholder?: string;
|
||||
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
||||
disabled?: boolean;
|
||||
};
|
||||
onError?: (status: string, clearSuggestion: () => void) => void;
|
||||
onSelect?: (address: string, placeID: string) => void;
|
||||
|
||||
Vendored
+3
@@ -642,6 +642,9 @@ export interface RowInfo {
|
||||
|
||||
/** An array of any expandable sub-rows contained in this row */
|
||||
subRows: any[];
|
||||
|
||||
/** Original object passed to row */
|
||||
original: any;
|
||||
}
|
||||
|
||||
export interface FinalState extends TableProps {
|
||||
|
||||
Vendored
+1
-1
@@ -1200,7 +1200,7 @@ declare namespace sequelize {
|
||||
* Attribute name for the relation
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
unique?: boolean | string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user