winston#debug TypeScript Examples
The following examples show how to use
winston#debug.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: testerSession.ts From Assistive-Webdriver with MIT License | 5 votes |
async waitAndCheckEvent(
testName: string,
type: string,
props: any,
action: () => Promise<void>,
filterEvents: (event: any) => boolean = () => true
) {
await this.assertQueueEmpty(filterEvents);
debug(`Testing ${type} event for ${testName}`);
let actionResult;
let event: any;
props = { ...props, type };
const propsKeys = Object.keys(props);
try {
await this.measureTime(type, async () => {
actionResult = action();
let maxEvents = 5;
let foundCorrectEvent = false;
while (!foundCorrectEvent) {
event = await this.eventsQueue.waitForValue();
if (!filterEvents(event)) {
continue;
}
maxEvents--;
const invalidKeys = [];
for (const key of propsKeys) {
if (event[key] !== props[key]) {
invalidKeys.push(key);
}
}
foundCorrectEvent = invalidKeys.length === 0;
if (!foundCorrectEvent) {
this.reportError(
`Unexpected value for ${invalidKeys.join(
", "
)} on event: expected ${JSON.stringify(
props
)} but got ${JSON.stringify(event)}`
);
if (maxEvents <= 0) {
throw new Error("Too many incorrect events!");
}
}
}
});
await actionResult;
} catch (error) {
this.reportError(
`Error while testing ${type} event for ${testName}: ${error}`
);
}
return event;
}
Example #2
Source File: testerSession.ts From Assistive-Webdriver with MIT License | 5 votes |
eventsServer = createEventsServer(event => {
debug("Received input event", event);
this.normalizeEvent(event);
this.eventsQueue.addValue(event);
});
Example #3
Source File: testerSession.ts From Assistive-Webdriver with MIT License | 5 votes |
async waitAndCheckEvent(
testName: string,
type: string,
props: any,
action: () => Promise<void>,
filterEvents: (event: any) => boolean = () => true
) {
await this.assertQueueEmpty(filterEvents);
debug(`Testing ${type} event for ${testName}`);
let actionResult;
let event: any;
props = { ...props, type };
const propsKeys = Object.keys(props);
try {
await this.measureTime(type, async () => {
actionResult = action();
let maxEvents = 5;
let foundCorrectEvent = false;
while (!foundCorrectEvent) {
event = await this.eventsQueue.waitForValue();
if (!filterEvents(event)) {
continue;
}
maxEvents--;
const invalidKeys = [];
for (const key of propsKeys) {
if (event[key] !== props[key]) {
invalidKeys.push(key);
}
}
foundCorrectEvent = invalidKeys.length === 0;
if (!foundCorrectEvent) {
this.reportError(
`Unexpected value for ${invalidKeys.join(
", "
)} on event: expected ${JSON.stringify(
props
)} but got ${JSON.stringify(event)}`
);
if (maxEvents <= 0) {
throw new Error("Too many incorrect events!");
}
}
}
});
await actionResult;
} catch (error) {
this.reportError(
`Error while testing ${type} event for ${testName}: ${error}`
);
}
return event;
}
Example #4
Source File: testerSession.ts From Assistive-Webdriver with MIT License | 5 votes |
eventsServer = createEventsServer(event => {
debug("Received input event", event);
this.normalizeEvent(event);
this.eventsQueue.addValue(event);
});