Add diagnostics API for logging and console output (#506)
* Initial implementation using logLevel alias for cleaner common imports * Use LogLevel in tests * lint bits * Correct write file logic * Add tests for Diagnostics * Correct test name * revert OCSP test changes
This commit is contained in:
Родитель
187711a363
Коммит
ba8be3e882
|
@ -5,7 +5,7 @@ import { Events } from "./src/common/Exports";
|
|||
|
||||
// Common.Storage.SetLocalStorage(new Common.Browser.LocalStorage());
|
||||
// Common.Storage.SetSessionStorage(new Common.Browser.SessionStorage());
|
||||
Events.instance.attachListener(new ConsoleLoggingListener());
|
||||
Events.instance.attachConsoleListener(new ConsoleLoggingListener());
|
||||
|
||||
// Speech SDK API
|
||||
export * from "./src/sdk/Exports";
|
||||
|
|
|
@ -2,33 +2,45 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import { EventType, IEventListener, PlatformEvent } from "../common/Exports";
|
||||
import * as fs from "fs";
|
||||
import { LogLevel } from "../sdk/LogLevel";
|
||||
import { IEventListener, PlatformEvent } from "../common/Exports";
|
||||
import { Contracts } from "../sdk/Contracts";
|
||||
|
||||
export class ConsoleLoggingListener implements IEventListener<PlatformEvent> {
|
||||
private privLogLevelFilter: EventType;
|
||||
private privLogLevelFilter: LogLevel;
|
||||
private privLogPath: fs.PathLike = undefined;
|
||||
|
||||
public constructor(logLevelFilter: EventType = EventType.Warning) {
|
||||
public constructor(logLevelFilter: LogLevel = LogLevel.None) { // Console output disabled by default
|
||||
this.privLogLevelFilter = logLevelFilter;
|
||||
}
|
||||
|
||||
public set logPath(path: fs.PathLike) {
|
||||
Contracts.throwIfNullOrUndefined(fs.openSync, "\nFile System access not available");
|
||||
this.privLogPath = path;
|
||||
}
|
||||
|
||||
public onEvent(event: PlatformEvent): void {
|
||||
if (event.eventType >= this.privLogLevelFilter) {
|
||||
const log = this.toString(event);
|
||||
if (!!this.privLogPath) {
|
||||
fs.writeFileSync(this.privLogPath, log + "\n", { flag: "a+" });
|
||||
}
|
||||
|
||||
switch (event.eventType) {
|
||||
case EventType.Debug:
|
||||
case LogLevel.Debug:
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug(log);
|
||||
break;
|
||||
case EventType.Info:
|
||||
case LogLevel.Info:
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(log);
|
||||
break;
|
||||
case EventType.Warning:
|
||||
case LogLevel.Warning:
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(log);
|
||||
break;
|
||||
case EventType.Error:
|
||||
case LogLevel.Error:
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(log);
|
||||
break;
|
||||
|
|
|
@ -12,6 +12,7 @@ export class EventSource<TEvent extends PlatformEvent> implements IEventSource<T
|
|||
private privEventListeners: IStringDictionary<(event: TEvent) => void> = {};
|
||||
private privMetadata: IStringDictionary<string>;
|
||||
private privIsDisposed: boolean = false;
|
||||
private privConsoleListener: IDetachable = undefined;
|
||||
|
||||
public constructor(metadata?: IStringDictionary<string>) {
|
||||
this.privMetadata = metadata;
|
||||
|
@ -56,6 +57,14 @@ export class EventSource<TEvent extends PlatformEvent> implements IEventSource<T
|
|||
return this.attach((e: TEvent): void => listener.onEvent(e));
|
||||
}
|
||||
|
||||
public attachConsoleListener(listener: IEventListener<TEvent>): IDetachable {
|
||||
if (!!this.privConsoleListener) {
|
||||
void this.privConsoleListener.detach(); // Detach implementation for eventListeners is synchronous
|
||||
}
|
||||
this.privConsoleListener = this.attach((e: TEvent): void => listener.onEvent(e));
|
||||
return this.privConsoleListener;
|
||||
}
|
||||
|
||||
public isDisposed(): boolean {
|
||||
return this.privIsDisposed;
|
||||
}
|
||||
|
|
|
@ -18,4 +18,6 @@ export interface IEventSource<TEvent extends PlatformEvent> extends IDisposable
|
|||
attach(onEventCallback: (event: TEvent) => void): IDetachable;
|
||||
|
||||
attachListener(listener: IEventListener<TEvent>): IDetachable;
|
||||
|
||||
attachConsoleListener(listener: IEventListener<TEvent>): IDetachable;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ export enum EventType {
|
|||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
None,
|
||||
}
|
||||
|
||||
export class PlatformEvent {
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
|
||||
//
|
||||
|
||||
import { ConsoleLoggingListener } from "../common.browser/Exports";
|
||||
import { Events } from "../common/Exports";
|
||||
import { LogLevel } from "./LogLevel";
|
||||
|
||||
/**
|
||||
* Defines diagnostics API for managing console output
|
||||
* Added in version 1.21.0
|
||||
*/
|
||||
export class Diagnostics {
|
||||
private static privListener: ConsoleLoggingListener = undefined;
|
||||
|
||||
public static SetLoggingLevel(logLevel: LogLevel): void {
|
||||
this.privListener = new ConsoleLoggingListener(logLevel);
|
||||
Events.instance.attachConsoleListener(this.privListener);
|
||||
}
|
||||
|
||||
public static SetLogOutputPath(path: string): void {
|
||||
if (typeof window === "undefined") {
|
||||
if (!!this.privListener) {
|
||||
this.privListener.logPath = path;
|
||||
}
|
||||
} else {
|
||||
throw new Error("File system logging not available in browser.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -104,3 +104,5 @@ export { PronunciationAssessmentConfig } from "./PronunciationAssessmentConfig";
|
|||
export { PronunciationAssessmentResult } from "./PronunciationAssessmentResult";
|
||||
export { LanguageIdMode } from "./LanguageIdMode";
|
||||
export { LanguageIdPriority } from "./LanguageIdPriority";
|
||||
export { Diagnostics } from "./Diagnostics";
|
||||
export { LogLevel } from "./LogLevel";
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import { EventType } from "../common/Exports";
|
||||
|
||||
/**
|
||||
* Define event severity types for setting logging output.
|
||||
* @class LogLevel
|
||||
*/
|
||||
|
||||
export { EventType as LogLevel };
|
|
@ -14,21 +14,21 @@ beforeAll(() => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
objsToClose = [];
|
||||
const used = process.memoryUsage().heapUsed / 1024 / 1024;
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Heap memory usage before test: ${Math.round(used * 100) / 100} MB`);
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
|
||||
const used = process.memoryUsage().heapUsed / 1024 / 1024;
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Heap memory usage after test: ${Math.round(used * 100) / 100} MB`);
|
||||
|
||||
done();
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
import * as sdk from "../microsoft.cognitiveservices.speech.sdk";
|
||||
import { ConsoleLoggingListener, WebsocketMessageAdapter } from "../src/common.browser/Exports";
|
||||
import { Events, EventType } from "../src/common/Exports";
|
||||
import { Events } from "../src/common/Exports";
|
||||
|
||||
import { Settings } from "./Settings";
|
||||
import { closeAsyncObjects, WaitForCondition } from "./Utilities";
|
||||
|
@ -32,7 +32,7 @@ let objsToClose: any[];
|
|||
beforeAll((): void => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach((): void => {
|
||||
|
@ -44,7 +44,7 @@ beforeEach((): void => {
|
|||
jest.setTimeout(12000);
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
afterEach(async (done: jest.DoneCallback): Promise<void> => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
|
@ -127,16 +127,16 @@ const BuildSourceLanguageConfigs: () => sdk.SourceLanguageConfig[] = (): sdk.Sou
|
|||
|
||||
describe.each([true, false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
||||
|
||||
beforeAll(() => {
|
||||
beforeAll((): void => {
|
||||
WebsocketMessageAdapter.forceNpmWebSocket = forceNodeWebSocket;
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
afterAll((): void => {
|
||||
WebsocketMessageAdapter.forceNpmWebSocket = false;
|
||||
});
|
||||
|
||||
test("testGetAutoDetectSourceLanguage", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
test("testGetAutoDetectSourceLanguage", (done: jest.DoneCallback): void => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testGetAutoDetectSourceLanguage");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -153,7 +153,7 @@ describe.each([true, false])("Service based tests", (forceNodeWebSocket: boolean
|
|||
}
|
||||
};
|
||||
|
||||
r.recognizeOnceAsync((result: sdk.SpeechRecognitionResult) => {
|
||||
r.recognizeOnceAsync((result: sdk.SpeechRecognitionResult): void => {
|
||||
try {
|
||||
expect(result).not.toBeUndefined();
|
||||
expect(result.errorDetails).toBeUndefined();
|
||||
|
@ -167,15 +167,15 @@ describe.each([true, false])("Service based tests", (forceNodeWebSocket: boolean
|
|||
|
||||
done();
|
||||
} catch (error) {
|
||||
done.fail(error);
|
||||
done.fail(error as string);
|
||||
}
|
||||
}, (error: string) => {
|
||||
}, (error: string): void => {
|
||||
done.fail(error);
|
||||
});
|
||||
});
|
||||
|
||||
test("testRecognizeFromSourceLanguageConfig", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
test("testRecognizeFromSourceLanguageConfig", (done: jest.DoneCallback): void => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testRecognizeFromSourceLanguageConfig");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -222,7 +222,7 @@ describe.each([true, false])("Service based tests", (forceNodeWebSocket: boolean
|
|||
});
|
||||
|
||||
test("Silence After Speech - AutoDetect set", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Silence After Speech - AutoDetect set");
|
||||
// Pump valid speech and then silence until at least one speech end cycle hits.
|
||||
const p: sdk.PushAudioInputStream = sdk.AudioInputStream.createPushStream();
|
||||
|
@ -312,7 +312,7 @@ describe.each([true, false])("Service based tests", (forceNodeWebSocket: boolean
|
|||
}, 30000);
|
||||
|
||||
test("testAddLIDCustomModels", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testAddLIDCustomModels");
|
||||
|
||||
const configs: sdk.SourceLanguageConfig[] = BuildSourceLanguageConfigs();
|
||||
|
@ -376,7 +376,7 @@ describe.each([true, false])("Service based tests", (forceNodeWebSocket: boolean
|
|||
}, 10000);
|
||||
|
||||
test("testContinuousLIDSpeechReco", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testContinuousLIDSpeechReco");
|
||||
|
||||
const configs: sdk.SourceLanguageConfig[] = BuildSourceLanguageConfigs();
|
||||
|
|
|
@ -28,19 +28,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -86,7 +86,7 @@ const BuildSpeechConfig: () => sdk.SpeechConfig = (): sdk.SpeechConfig => {
|
|||
};
|
||||
|
||||
test("Connect / Disconnect", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Connect / Disconnect");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -116,7 +116,7 @@ test("Connect / Disconnect", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("Disconnect during reco cancels.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Disconnect during reco cancels.");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -208,7 +208,7 @@ test("Disconnect during reco cancels.", (done: jest.DoneCallback) => {
|
|||
}, 10000);
|
||||
|
||||
test("Open during reco has no effect.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Open during reco has no effect.");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -307,7 +307,7 @@ test("Open during reco has no effect.", (done: jest.DoneCallback) => {
|
|||
}, 10000);
|
||||
|
||||
test("Connecting before reco works for cont", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Connecting before reco works for cont");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -418,7 +418,7 @@ test("Connecting before reco works for cont", (done: jest.DoneCallback) => {
|
|||
}, 10000);
|
||||
|
||||
test.skip("Switch RecoModes during a connection (cont->single)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Switch RecoModes during a connection (cont->single)");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -525,7 +525,7 @@ test.skip("Switch RecoModes during a connection (cont->single)", (done: jest.Don
|
|||
}, 20000);
|
||||
|
||||
test.skip("Switch RecoModes during a connection (single->cont)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Switch RecoModes during a connection (single->cont)");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -632,7 +632,7 @@ test.skip("Switch RecoModes during a connection (single->cont)", (done: jest.Don
|
|||
}, 20000);
|
||||
|
||||
test("testAudioMessagesSent", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testAudioMessagesSent");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -707,7 +707,7 @@ test("testAudioMessagesSent", (done: jest.DoneCallback) => {
|
|||
}, 10000);
|
||||
|
||||
test("testModifySpeechContext", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testModifySpeechContext");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -760,7 +760,7 @@ test("testModifySpeechContext", (done: jest.DoneCallback) => {
|
|||
}, 10000);
|
||||
|
||||
test("testModifySynthesisContext", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testModifySynthesisContext");
|
||||
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -808,7 +808,7 @@ test("testModifySynthesisContext", (done: jest.DoneCallback) => {
|
|||
}, 10000);
|
||||
|
||||
test("Test SendMessage Basic", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Test SendMessage Basic");
|
||||
|
||||
const r = BuildRecognizerFromWaveFile();
|
||||
|
@ -834,7 +834,7 @@ test("Test SendMessage Basic", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("Test SendMessage Binary", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Test SendMessage Binary");
|
||||
|
||||
const r = BuildRecognizerFromWaveFile();
|
||||
|
@ -858,7 +858,7 @@ test("Test SendMessage Binary", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("Test InjectMessage", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Test InjectMessage");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
|
|
@ -23,20 +23,20 @@ function sleep(milliseconds: number): Promise<any> {
|
|||
beforeAll(() => {
|
||||
// Override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
jest.setTimeout(12000);
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -116,7 +116,7 @@ const GetParticipantSteve: () => sdk.IParticipant = (): sdk.IParticipant => {
|
|||
};
|
||||
|
||||
test("CreateConversation", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: CreateConversation");
|
||||
CreateConversation().then( (c: sdk.Conversation) => {
|
||||
objsToClose.push(c);
|
||||
|
@ -125,7 +125,7 @@ test("CreateConversation", () => {
|
|||
});
|
||||
|
||||
test("BuildTranscriber", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: BuildTranscriber");
|
||||
const t: sdk.ConversationTranscriber = BuildTranscriber();
|
||||
|
||||
|
@ -133,7 +133,7 @@ test("BuildTranscriber", () => {
|
|||
});
|
||||
|
||||
test("Create Conversation and join to Transcriber", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Create Conversation and join to Transcriber");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -165,7 +165,7 @@ test("Create Conversation and join to Transcriber", (done: jest.DoneCallback) =>
|
|||
});
|
||||
|
||||
test("Create Conversation and add participants", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Create Conversation and add participants");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
s.outputFormat = sdk.OutputFormat.Detailed;
|
||||
|
@ -258,7 +258,7 @@ test("Create Conversation and add participants", (done: jest.DoneCallback) => {
|
|||
}, 50000);
|
||||
|
||||
test("Leave Conversation", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Leave Conversation");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -343,7 +343,7 @@ test("Leave Conversation", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("Create Conversation with one channel audio (aligned)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Create Conversation with one channel audio (aligned)");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
s.outputFormat = sdk.OutputFormat.Detailed;
|
||||
|
@ -432,7 +432,7 @@ test("Create Conversation with one channel audio (aligned)", (done: jest.DoneCal
|
|||
});
|
||||
|
||||
test.skip("Create Conversation and force disconnect", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Create Conversation and force disconnect");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
|
|
@ -20,13 +20,13 @@ import {
|
|||
} from "./Utilities";
|
||||
import { WaveFileAudioInput } from "./WaveFileAudioInputStream";
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
const consoleInfo = console.info;
|
||||
|
||||
const endpointHost: string = Settings.ConversationTranslatorHost;
|
||||
const speechEndpointHost: string = Settings.ConversationTranslatorSpeechHost;
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info = (...args: any[]): void => {
|
||||
|
||||
const formatConsoleDate = (): string => {
|
||||
|
@ -55,18 +55,18 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// Override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
beforeAll(() => jest.setTimeout(90 * 1000));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -277,7 +277,7 @@ describe("conversation service tests", () => {
|
|||
|
||||
test("Start Conversation, join as host and mute participants", (done: jest.DoneCallback) => {
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Conversation, join as host, mute participants");
|
||||
|
||||
let participantsCount: number = 0;
|
||||
|
@ -371,7 +371,7 @@ describe("conversation service tests", () => {
|
|||
|
||||
test("Start Conversation, join as host and send message", (done: jest.DoneCallback) => {
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Conversation, join as host and send message");
|
||||
|
||||
let textMessage: string = "";
|
||||
|
@ -394,7 +394,7 @@ describe("conversation service tests", () => {
|
|||
sendMessage(`Hello ${e.participants[0].displayName}`);
|
||||
});
|
||||
ct.textMessageReceived = ((s: sdk.ConversationTranslator, e: sdk.ConversationTranslationEventArgs) => {
|
||||
// tslint:disable-next-line: no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`text message received: ${e.result.text}`);
|
||||
textMessage = e.result.text;
|
||||
});
|
||||
|
@ -408,17 +408,17 @@ describe("conversation service tests", () => {
|
|||
ct.joinConversationAsync(c, "Host",
|
||||
(() => {
|
||||
// continue
|
||||
// tslint:disable-next-line: no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("joined");
|
||||
}),
|
||||
((error: any) => {
|
||||
// tslint:disable-next-line: no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("error joining: " + error);
|
||||
done.fail();
|
||||
}));
|
||||
}),
|
||||
((error: any) => {
|
||||
// tslint:disable-next-line: no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("error starting: " + error);
|
||||
done.fail();
|
||||
}));
|
||||
|
@ -433,7 +433,7 @@ describe("conversation service tests", () => {
|
|||
|
||||
test("Start Conversation, join as host and eject participant", (done: jest.DoneCallback) => {
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Conversation, join as host and eject participant");
|
||||
|
||||
let participantsCount: number = 0;
|
||||
|
@ -568,7 +568,7 @@ describe("conversation translator service tests", () => {
|
|||
|
||||
test("Join Conversation Translator, invalid conversation code [400027]", (done: jest.DoneCallback) => {
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Join Conversation Translator, invalid conversation code [400027]");
|
||||
|
||||
const audioConfig = sdk.AudioConfig.fromDefaultMicrophoneInput();
|
||||
|
@ -601,7 +601,7 @@ describe("conversation translator service tests", () => {
|
|||
|
||||
test("Join Conversation Translator, duplicate nickname [400028]", (done: jest.DoneCallback) => {
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Join Conversation Translator, duplicate nickname [400028]");
|
||||
|
||||
let errorMessage: string = "";
|
||||
|
@ -660,7 +660,7 @@ describe("conversation translator service tests", () => {
|
|||
|
||||
test.skip("Join Conversation Translator, locked conversation [400044]", (done: jest.DoneCallback) => {
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Join Conversation Translator, locked conversation [400044]");
|
||||
|
||||
// start a conversation
|
||||
|
@ -709,7 +709,7 @@ describe("conversation translator service tests", () => {
|
|||
|
||||
test("Start Conversation Translator, join as host with speech language and speak", (done: jest.DoneCallback) => {
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Conversation, join as host with speech language and speak");
|
||||
|
||||
// audio config
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import * as fs from "fs";
|
||||
import * as sdk from "../microsoft.cognitiveservices.speech.sdk";
|
||||
import { Settings } from "./Settings";
|
||||
import { closeAsyncObjects, WaitForCondition } from "./Utilities";
|
||||
|
||||
|
||||
let objsToClose: any[];
|
||||
|
||||
beforeAll((): void => {
|
||||
// Override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
});
|
||||
|
||||
beforeEach((): void => {
|
||||
objsToClose = [];
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback): Promise<void> => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
});
|
||||
|
||||
const BuildSpeechConfig: () => sdk.SpeechConfig = (): sdk.SpeechConfig => {
|
||||
|
||||
let s: sdk.SpeechConfig;
|
||||
if (undefined === Settings.SpeechEndpoint) {
|
||||
s = sdk.SpeechConfig.fromSubscription(Settings.SpeechSubscriptionKey, Settings.SpeechRegion);
|
||||
} else {
|
||||
s = sdk.SpeechConfig.fromEndpoint(new URL(Settings.SpeechEndpoint), Settings.SpeechSubscriptionKey);
|
||||
}
|
||||
|
||||
if (undefined !== Settings.proxyServer) {
|
||||
s.setProxy(Settings.proxyServer, Settings.proxyPort);
|
||||
}
|
||||
|
||||
expect(s).not.toBeUndefined();
|
||||
return s;
|
||||
};
|
||||
|
||||
Settings.testIfNode("Debug Console output writes to log file", (done: jest.DoneCallback): void => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Debug Console output writes to log file");
|
||||
|
||||
sdk.Diagnostics.SetLoggingLevel(sdk.LogLevel.Debug);
|
||||
sdk.Diagnostics.SetLogOutputPath(Settings.TestLogPath);
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
||||
const r: sdk.SpeechRecognizer = new sdk.SpeechRecognizer(s);
|
||||
objsToClose.push(r);
|
||||
|
||||
let connected: boolean = false;
|
||||
const connection: sdk.Connection = sdk.Connection.fromRecognizer(r);
|
||||
|
||||
connection.connected = (): void => {
|
||||
connected = true;
|
||||
};
|
||||
|
||||
connection.disconnected = (): void => {
|
||||
expect(fs.existsSync(Settings.TestLogPath)).toEqual(true);
|
||||
if (fs.existsSync(Settings.TestLogPath)) {
|
||||
const fileContents: string | Buffer = fs.readFileSync(Settings.TestLogPath);
|
||||
expect(fileContents.length).toBeGreaterThan(0);
|
||||
const firstLine = fileContents.toString().split("\n")[0];
|
||||
expect(firstLine.length).toBeGreaterThan(0);
|
||||
expect(firstLine.split(" | ")[1].endsWith("Event")).toEqual(true);
|
||||
fs.unlinkSync(Settings.TestLogPath);
|
||||
}
|
||||
done();
|
||||
};
|
||||
|
||||
connection.openConnection();
|
||||
|
||||
WaitForCondition((): boolean => connected, (): void => {
|
||||
connection.closeConnection();
|
||||
});
|
||||
});
|
||||
|
||||
Settings.testIfDOMCondition("Diagnostics log file throws", (): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
sdk.Diagnostics.SetLoggingLevel(sdk.LogLevel.Debug);
|
||||
expect((): void => sdk.Diagnostics.SetLogOutputPath(Settings.TestLogPath)).toThrow();
|
||||
});
|
|
@ -79,7 +79,7 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// Override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -176,7 +176,7 @@ test("Create BotFrameworkConfig, null optional botId", () => {
|
|||
});
|
||||
|
||||
test("Create DialogServiceConnector, BotFrameworkConfig.fromSubscription", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Create DialogServiceConnector, BotFrameworkConfig.fromSubscription");
|
||||
|
||||
const connectorConfig: sdk.BotFrameworkConfig = sdk.BotFrameworkConfig.fromSubscription(Settings.BotSubscription, Settings.BotRegion);
|
||||
|
@ -192,7 +192,7 @@ test("Create DialogServiceConnector, BotFrameworkConfig.fromSubscription", () =>
|
|||
});
|
||||
|
||||
test("Output format, default", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Output format, default");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -202,7 +202,7 @@ test("Output format, default", () => {
|
|||
});
|
||||
|
||||
test("Create BotFrameworkConfig, invalid optional botId", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Create BotFrameworkConfig, invalid optional botId");
|
||||
|
||||
const botConfig: sdk.BotFrameworkConfig = sdk.BotFrameworkConfig.fromSubscription(Settings.BotSubscription, Settings.BotRegion, "potato");
|
||||
|
@ -229,7 +229,7 @@ test("Create BotFrameworkConfig, invalid optional botId", (done: jest.DoneCallba
|
|||
}, 15000);
|
||||
|
||||
test("Connect / Disconnect", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Connect / Disconnect");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -245,7 +245,7 @@ test("Connect / Disconnect", (done: jest.DoneCallback) => {
|
|||
expect(connector).not.toBeUndefined();
|
||||
|
||||
connector.canceled = (sender: sdk.DialogServiceConnector, args: sdk.SpeechRecognitionCanceledEventArgs) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Error code: %d, error details: %s, error reason: %d", args.errorCode, args.errorDetails, args.reason);
|
||||
};
|
||||
|
||||
|
@ -273,7 +273,7 @@ test("Connect / Disconnect", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("GetDetailedOutputFormat", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: GetDetailedOutputFormat");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -299,7 +299,7 @@ test("GetDetailedOutputFormat", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("ListenOnceAsync", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: ListenOnceAsync");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -371,7 +371,7 @@ test("ListenOnceAsync", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
Settings.testIfDOMCondition("ListenOnceAsync with audio response", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: ListenOnceAsync with audio response");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -463,7 +463,7 @@ Settings.testIfDOMCondition("ListenOnceAsync with audio response", (done: jest.D
|
|||
}, 15000);
|
||||
|
||||
Settings.testIfDOMCondition("Successive ListenOnceAsync with audio response", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Successive ListenOnceAsync with audio response");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -552,7 +552,7 @@ Settings.testIfDOMCondition("Successive ListenOnceAsync with audio response", (d
|
|||
}, 15000);
|
||||
|
||||
test("Successive ListenOnceAsync calls", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Successive ListenOnceAsync calls");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -624,7 +624,7 @@ test("Successive ListenOnceAsync calls", (done: jest.DoneCallback) => {
|
|||
}, 15000);
|
||||
|
||||
test("ListenOnceAsync with silence returned", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: ListenOnceAsync with silence returned");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -693,7 +693,7 @@ test("ListenOnceAsync with silence returned", (done: jest.DoneCallback) => {
|
|||
}, 15000);
|
||||
|
||||
test("Send/Receive messages", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Send/Receive messages");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -737,7 +737,7 @@ test("Send/Receive messages", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("Send multiple messages", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Send multiple messages");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -786,7 +786,7 @@ test("Send multiple messages", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("Send/Receive messages during ListenOnce", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Send/Receive messages during ListenOnce");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
@ -847,7 +847,7 @@ test("Send/Receive messages during ListenOnce", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("SendActivity fails with invalid JSON object", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: SendActivity fails with invalid JSON object");
|
||||
|
||||
const dialogConfig: sdk.BotFrameworkConfig = BuildBotFrameworkConfig();
|
||||
|
|
|
@ -14,7 +14,7 @@ beforeAll(() => {
|
|||
Settings.LoadSettings();
|
||||
});
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
beforeEach(() => console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------"));
|
||||
|
||||
test("Empty Grammar, empty output.", () => {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { Settings } from "./Settings";
|
|||
import { WaveFileAudioInput } from "./WaveFileAudioInputStream";
|
||||
|
||||
beforeEach(() => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("-------------------Starting test case: " + expect.getState().currentTestName + "---------------");
|
||||
// Override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
|
|
|
@ -21,19 +21,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -78,7 +78,7 @@ const BuildSpeechConfig: () => sdk.SpeechConfig = (): sdk.SpeechConfig => {
|
|||
describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
||||
|
||||
beforeEach(() => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("forceNodeWebSocket: " + forceNodeWebSocket);
|
||||
WebsocketMessageAdapter.forceNpmWebSocket = forceNodeWebSocket;
|
||||
});
|
||||
|
@ -88,7 +88,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("NoIntentsRecognizesSpeech", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: NoIntentsRecognizesSpeech");
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -119,7 +119,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("AddNullIntent", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: AddNullIntent");
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -128,7 +128,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("AddNullPhrase", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: AddNullPhrase");
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -137,7 +137,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("RoundTripWithGoodIntent", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: RoundTripWithGoodIntent");
|
||||
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile();
|
||||
|
@ -180,7 +180,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}
|
||||
|
||||
test("AddIntentWithBadModel", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: AddIntentWithBadModel");
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -192,7 +192,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("InitialSilenceTimeout (pull)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialSilenceTimeout (pull)");
|
||||
let p: sdk.PullAudioInputStream;
|
||||
let bytesSent: number = 0;
|
||||
|
@ -222,7 +222,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 20000);
|
||||
|
||||
test("InitialSilenceTimeout (push)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialSilenceTimeout (push)");
|
||||
|
||||
const p: sdk.PushAudioInputStream = sdk.AudioInputStream.createPushStream();
|
||||
|
@ -236,7 +236,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 20000);
|
||||
|
||||
Settings.testIfDOMCondition("InitialSilenceTimeout (File)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialSilenceTimeout (File)");
|
||||
const audioFormat: AudioStreamFormatImpl = sdk.AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl;
|
||||
|
||||
|
@ -311,7 +311,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
};
|
||||
|
||||
test("Continous Recog With Intent", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Continous Recog With Intent");
|
||||
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile();
|
||||
|
@ -367,7 +367,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 20000);
|
||||
|
||||
test("RoundTripWithGoodModelWrongIntent", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: RoundTripWithGoodModelWrongIntent");
|
||||
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile();
|
||||
|
@ -404,7 +404,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 20000);
|
||||
|
||||
test("MultiPhrase Intent", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: MultiPhrase Intent");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -508,7 +508,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 20000);
|
||||
|
||||
test("IntentAlias", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: IntentAlias");
|
||||
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile();
|
||||
|
@ -546,7 +546,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 20000);
|
||||
|
||||
test("Add All Intents", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Add All Intents");
|
||||
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile();
|
||||
|
@ -584,7 +584,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 20000);
|
||||
|
||||
test("Add All Intents with alias", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Add All Intents with alias");
|
||||
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile();
|
||||
|
@ -621,7 +621,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 20000);
|
||||
|
||||
test("Audio Config is optional", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Audio Config is optional");
|
||||
|
||||
const s: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription(Settings.SpeechSubscriptionKey, Settings.SpeechRegion);
|
||||
|
@ -635,7 +635,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Default mic is used when audio config is not specified.", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Default mic is used when audio config is not specified.");
|
||||
|
||||
const s: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription(Settings.SpeechSubscriptionKey, Settings.SpeechRegion);
|
||||
|
@ -659,7 +659,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Connection Errors Propogate Async", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Connection Errors Propogate Async");
|
||||
|
||||
const s: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription("badKey", Settings.SpeechRegion);
|
||||
|
@ -682,7 +682,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Connection Errors Propogate Sync", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Connection Errors Propogate Sync");
|
||||
|
||||
const s: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription("badKey", Settings.SpeechRegion);
|
||||
|
@ -721,7 +721,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
|
||||
// Bing Speech does not behave the same as Unified Speech for a bad language. It closes the connection far more gracefully.
|
||||
test.skip("RecognizeOnce Bad Language", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: RecognizeOnce Bad Language");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -759,7 +759,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Silence After Speech", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Silence After Speech");
|
||||
|
||||
// Pump valid speech and then silence until at least one speech end cycle hits.
|
||||
|
@ -849,7 +849,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 35000);
|
||||
|
||||
test("Silence Then Speech", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Silence Then Speech");
|
||||
|
||||
// Pump valid speech and then silence until at least one speech end cycle hits.
|
||||
|
@ -935,7 +935,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Ambiguous Speech default as expected", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Ambiguous Speech default as expected");
|
||||
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile(undefined, Settings.AmbiguousWaveFile);
|
||||
|
@ -965,7 +965,7 @@ test("Ambiguous Speech default as expected", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test.skip("Phraselist assists speech Reco.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Phraselist assists speech Reco.");
|
||||
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile(undefined, Settings.AmbiguousWaveFile);
|
||||
|
@ -999,7 +999,7 @@ test.skip("Phraselist assists speech Reco.", (done: jest.DoneCallback) => {
|
|||
|
||||
test("Phraselist Clear works.", (done: jest.DoneCallback) => {
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Phraselist Clear works.");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -1099,7 +1099,7 @@ test("Phraselist Clear works.", (done: jest.DoneCallback) => {
|
|||
}, 20000);
|
||||
|
||||
test.skip("Phraselist extra phraselists have no effect.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Phraselist extra phraselists have no effect.");
|
||||
|
||||
const r: sdk.IntentRecognizer = BuildRecognizerFromWaveFile(undefined, Settings.AmbiguousWaveFile);
|
||||
|
|
|
@ -14,19 +14,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
objsToClose.forEach((value: any, index: number, array: any[]) => {
|
||||
if (typeof value.close === "function") {
|
||||
|
@ -36,11 +36,11 @@ afterEach(() => {
|
|||
});
|
||||
|
||||
test("Non-refreshed auth token has sensible error message", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Non-refreshed auth token has sensible error message");
|
||||
|
||||
if (!Settings.ExecuteLongRunningTestsBool) {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Skipping test.");
|
||||
done();
|
||||
return;
|
||||
|
|
|
@ -14,19 +14,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
objsToClose.forEach((value: any, index: number, array: any[]) => {
|
||||
if (typeof value.close === "function") {
|
||||
|
@ -36,11 +36,11 @@ afterEach(() => {
|
|||
});
|
||||
|
||||
test("AuthToken refresh works correctly", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: AuthToken refresh works correctly");
|
||||
|
||||
if (!Settings.ExecuteLongRunningTestsBool) {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Skipping test.");
|
||||
done();
|
||||
return;
|
||||
|
@ -106,9 +106,8 @@ test("AuthToken refresh works correctly", (done: jest.DoneCallback) => {
|
|||
|
||||
// Close p in 20 minutes.
|
||||
const endTime: number = Date.now() + (1000 * 60 * 20); // 20 min.
|
||||
WaitForCondition(() => {
|
||||
return Date.now() >= endTime;
|
||||
}, () => {
|
||||
WaitForCondition((): boolean => Date.now() >= endTime,
|
||||
(): void => {
|
||||
streamStopped = true;
|
||||
p.close();
|
||||
});
|
||||
|
@ -119,16 +118,14 @@ test("AuthToken refresh works correctly", (done: jest.DoneCallback) => {
|
|||
objsToClose.push(r);
|
||||
|
||||
// auto refresh the auth token.
|
||||
const refreshAuthToken = () => {
|
||||
const refreshAuthToken = (): void => {
|
||||
if (canceled && !inTurn) {
|
||||
return;
|
||||
}
|
||||
|
||||
request.post(req, (error: any, response: request.Response, body: any) => {
|
||||
r.authorizationToken = body;
|
||||
});
|
||||
request.post(req, (error: any, response: request.Response, body: any): void => r.authorizationToken = body);
|
||||
|
||||
setTimeout(() => {
|
||||
setTimeout((): void => {
|
||||
refreshAuthToken();
|
||||
}, 1000 * 60 * 9); // 9 minutes
|
||||
};
|
||||
|
@ -159,7 +156,7 @@ test("AuthToken refresh works correctly", (done: jest.DoneCallback) => {
|
|||
}
|
||||
|
||||
} catch (error) {
|
||||
done.fail(error);
|
||||
done.fail(error as string);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -206,11 +203,11 @@ test("AuthToken refresh works correctly", (done: jest.DoneCallback) => {
|
|||
}, 1000 * 60 * 25); // 25 minutes.
|
||||
|
||||
test("AuthToken refresh works correctly for Translation Recognizer", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: AuthToken refresh works correctly for Translation Recognizer");
|
||||
|
||||
if (!Settings.ExecuteLongRunningTestsBool) {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Skipping test.");
|
||||
done();
|
||||
return;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
import * as sdk from "../../microsoft.cognitiveservices.speech.sdk";
|
||||
import { ConsoleLoggingListener, WebsocketMessageAdapter } from "../../src/common.browser/Exports";
|
||||
import { Events, EventType, PlatformEvent } from "../../src/common/Exports";
|
||||
import { ConsoleLoggingListener } from "../../src/common.browser/Exports";
|
||||
import { Events } from "../../src/common/Exports";
|
||||
|
||||
import { Settings } from "../Settings";
|
||||
import { WaveFileAudioInput } from "../WaveFileAudioInputStream";
|
||||
|
@ -11,24 +11,24 @@ import { WaitForCondition } from "../Utilities";
|
|||
|
||||
let objsToClose: any[];
|
||||
|
||||
beforeAll(() => {
|
||||
beforeAll((): void => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach((): void => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// tslint:disable-next-line:no-console
|
||||
afterEach((): void => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
objsToClose.forEach((value: any, index: number, array: any[]) => {
|
||||
objsToClose.forEach((value: { close: () => any }): void => {
|
||||
if (typeof value.close === "function") {
|
||||
value.close();
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ const BuildSpeechConfig: () => sdk.SpeechConfig = (): sdk.SpeechConfig => {
|
|||
};
|
||||
|
||||
// Tests client reconnect after speech timeouts.
|
||||
test("Reconnect After timeout", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
test("Reconnect After timeout", (done: jest.DoneCallback): void => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Reconnect After timeout");
|
||||
|
||||
// Pump valid speech and then silence until at least one speech end cycle hits.
|
||||
|
@ -58,17 +58,16 @@ test("Reconnect After timeout", (done: jest.DoneCallback) => {
|
|||
|
||||
const alternatePhraseFileBuffer: ArrayBuffer = WaveFileAudioInput.LoadArrayFromFile(Settings.LuisWaveFile);
|
||||
|
||||
let p: sdk.PullAudioInputStream;
|
||||
let s: sdk.SpeechConfig;
|
||||
if (undefined === Settings.SpeechTimeoutEndpoint || undefined === Settings.SpeechTimeoutKey) {
|
||||
if (!Settings.ExecuteLongRunningTestsBool) {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Skipping test.");
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn("Running timeout test against production, this will be very slow...");
|
||||
s = BuildSpeechConfig();
|
||||
} else {
|
||||
|
@ -89,9 +88,10 @@ test("Reconnect After timeout", (done: jest.DoneCallback) => {
|
|||
const targetLoops: number = 500;
|
||||
|
||||
// Pump the audio from the wave file specified with 1 second silence between iterations indefinetly.
|
||||
p = sdk.AudioInputStream.createPullStream(
|
||||
const p = sdk.AudioInputStream.createPullStream(
|
||||
{
|
||||
close: () => { return; },
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
close: (): void => { },
|
||||
read: (buffer: ArrayBuffer): number => {
|
||||
if (pumpSilence) {
|
||||
bytesSent += buffer.byteLength;
|
||||
|
@ -139,7 +139,7 @@ test("Reconnect After timeout", (done: jest.DoneCallback) => {
|
|||
|
||||
const connection: sdk.Connection = sdk.Connection.fromRecognizer(r);
|
||||
|
||||
r.recognized = (o: sdk.Recognizer, e: sdk.SpeechRecognitionEventArgs) => {
|
||||
r.recognized = (o: sdk.Recognizer, e: sdk.SpeechRecognitionEventArgs): void => {
|
||||
try {
|
||||
// If the target number of loops has been seen already, don't check as the audio being sent could have been clipped randomly during a phrase,
|
||||
// and failing because of that isn't warranted.
|
||||
|
@ -173,7 +173,7 @@ test("Reconnect After timeout", (done: jest.DoneCallback) => {
|
|||
}
|
||||
}
|
||||
} catch (error) {
|
||||
done.fail(error);
|
||||
done.fail(error as string);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -182,34 +182,34 @@ test("Reconnect After timeout", (done: jest.DoneCallback) => {
|
|||
expect(e.errorDetails).toBeUndefined();
|
||||
expect(sdk.CancellationReason[e.reason]).toEqual(sdk.CancellationReason[sdk.CancellationReason.EndOfStream]);
|
||||
} catch (error) {
|
||||
done.fail(error);
|
||||
done.fail(error as string);
|
||||
}
|
||||
};
|
||||
|
||||
connection.disconnected = (e: sdk.SessionEventArgs) => {
|
||||
connection.disconnected = (): void => {
|
||||
disconnects++;
|
||||
};
|
||||
|
||||
connection.connected = (e: sdk.SessionEventArgs) => {
|
||||
connection.connected = (): void => {
|
||||
connections++;
|
||||
};
|
||||
|
||||
r.startContinuousRecognitionAsync(() => {
|
||||
WaitForCondition(() => (!!postDisconnectReco), () => {
|
||||
r.stopContinuousRecognitionAsync(() => {
|
||||
r.startContinuousRecognitionAsync((): void => {
|
||||
WaitForCondition((): boolean => (!!postDisconnectReco), (): void => {
|
||||
r.stopContinuousRecognitionAsync((): void => {
|
||||
try {
|
||||
expect(connections).toEqual(2);
|
||||
expect(disconnects).toEqual(1);
|
||||
done();
|
||||
} catch (error) {
|
||||
done.fail(error);
|
||||
done.fail(error as string);
|
||||
}
|
||||
}, (error: string) => {
|
||||
}, (error: string): void => {
|
||||
done.fail(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
(err: string) => {
|
||||
(err: string): void => {
|
||||
done.fail(err);
|
||||
});
|
||||
}, 1000 * 60 * 35);
|
||||
|
|
|
@ -15,6 +15,7 @@ let objsToClose: any[];
|
|||
beforeAll((): void => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
});
|
||||
|
||||
|
@ -81,6 +82,7 @@ test("Reconnect After timeout", (done: jest.DoneCallback): void => {
|
|||
// Pump the audio from the wave file specified with 1 second silence between iterations indefinetly.
|
||||
const p = sdk.AudioInputStream.createPullStream(
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
close: (): void => { },
|
||||
read: (buffer: ArrayBuffer): number => {
|
||||
if (pumpSilence) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import {
|
|||
} from "../src/common.browser/Exports";
|
||||
import {
|
||||
Events,
|
||||
EventType
|
||||
} from "../src/common/Exports";
|
||||
import { Settings } from "./Settings";
|
||||
import { closeAsyncObjects } from "./Utilities";
|
||||
|
@ -20,22 +19,22 @@ import { WaveFileAudioInput } from "./WaveFileAudioInputStream";
|
|||
|
||||
let objsToClose: any[];
|
||||
|
||||
beforeAll(() => {
|
||||
beforeAll((): void => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach((): void => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
afterEach(async (done: jest.DoneCallback): Promise<void> => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -81,8 +80,8 @@ const BuildSpeechConfig: () => sdk.SpeechConfig = (): sdk.SpeechConfig => {
|
|||
return s;
|
||||
};
|
||||
|
||||
test("testPronunciationAssessmentConfig::normal", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
test("testPronunciationAssessmentConfig::normal", (done: jest.DoneCallback): void => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testPronunciationAssessmentConfig:::normal");
|
||||
let pronConfig: sdk.PronunciationAssessmentConfig = new sdk.PronunciationAssessmentConfig("reference");
|
||||
let j = JSON.parse(pronConfig.toJSON());
|
||||
|
@ -121,8 +120,8 @@ test("testPronunciationAssessmentConfig::normal", (done: jest.DoneCallback) => {
|
|||
done();
|
||||
});
|
||||
|
||||
test("testPronunciationAssessmentConfig::fromJson", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
test("testPronunciationAssessmentConfig::fromJson", (done: jest.DoneCallback): void => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testPronunciationAssessmentConfig::fromJson");
|
||||
const jsonString = `{"dimension": "Comprehensive", "enableMiscue": false, "key": "value"}`;
|
||||
const pronConfig = sdk.PronunciationAssessmentConfig.fromJSON(jsonString);
|
||||
|
@ -130,18 +129,18 @@ test("testPronunciationAssessmentConfig::fromJson", (done: jest.DoneCallback) =>
|
|||
done();
|
||||
});
|
||||
|
||||
describe.each([true, false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
||||
describe.each([true, false])("Service based tests", (forceNodeWebSocket: boolean): void => {
|
||||
|
||||
beforeAll(() => {
|
||||
beforeAll((): void => {
|
||||
WebsocketMessageAdapter.forceNpmWebSocket = forceNodeWebSocket;
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
afterAll((): void => {
|
||||
WebsocketMessageAdapter.forceNpmWebSocket = false;
|
||||
});
|
||||
|
||||
test("test Pronunciation Assessment with reference text", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: test Pronunciation Assessment with reference text");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -192,7 +191,7 @@ describe.each([true, false])("Service based tests", (forceNodeWebSocket: boolean
|
|||
});
|
||||
|
||||
test("test Pronunciation Assessment without reference text", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: test Pronunciation Assessment without reference text");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -237,7 +236,7 @@ describe.each([true, false])("Service based tests", (forceNodeWebSocket: boolean
|
|||
});
|
||||
|
||||
test("test Pronunciation Assessment with ipa phoneme set", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: test Pronunciation Assessment with ipa phoneme set");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
|
|
@ -22,7 +22,7 @@ beforeAll(() => {
|
|||
bufferSize = (AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl).avgBytesPerSec / 10;
|
||||
});
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
beforeEach(() => console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------"));
|
||||
|
||||
test("PullStream correctly reports bytes read", async (done: jest.DoneCallback) => {
|
||||
|
|
|
@ -22,7 +22,7 @@ beforeAll(() => {
|
|||
bufferSize = (AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl).avgBytesPerSec / 10;
|
||||
});
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
beforeEach(() => console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------"));
|
||||
|
||||
test("Push segments into small blocks", (done: jest.DoneCallback) => {
|
||||
|
|
|
@ -51,7 +51,7 @@ const writeBufferToConsole: (buffer: ArrayBuffer) => void = (buffer: ArrayBuffer
|
|||
out += readView[i] + " ";
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(out);
|
||||
};
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ export class Settings {
|
|||
public static InputDir: string = "tests/input/audio/";
|
||||
|
||||
public static ExecuteLongRunningTests: string = "false";
|
||||
public static TestLogPath: string = "./TEST_LOG.txt";
|
||||
|
||||
public static get ExecuteLongRunningTestsBool(): boolean {
|
||||
return "false" !== this.ExecuteLongRunningTests;
|
||||
|
@ -101,6 +102,7 @@ export class Settings {
|
|||
public static CustomVoiceEndpointId: string = "6b231818-6b8c-4452-9a69-2009355d5d7a";
|
||||
public static CustomVoiceVoiceName: string = "sdk-test";
|
||||
public static testIfDOMCondition: jest.It = (typeof window === "undefined") ? test.skip : test;
|
||||
public static testIfNode: jest.It = (typeof window !== "undefined") ? test.skip : test;
|
||||
|
||||
public static initialize(): void {
|
||||
Settings.SettingsClassLock = new Settings();
|
||||
|
|
|
@ -23,17 +23,17 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// Override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -617,7 +617,7 @@ describe("Connection URL Tests", () => {
|
|||
sdk.SpeechRecognizer | sdk.TranslationRecognizer | sdk.IntentRecognizer | sdk.SpeechSynthesizer) => {
|
||||
|
||||
test("Simple Host and protocol", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Simple Host and protocol");
|
||||
|
||||
testHostConnection(createMethod,
|
||||
|
@ -628,7 +628,7 @@ describe("Connection URL Tests", () => {
|
|||
}, 30000);
|
||||
|
||||
test("Simple Host, protocol, and port", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Simple Host, protocol, and port");
|
||||
|
||||
testHostConnection(createMethod,
|
||||
|
@ -696,7 +696,7 @@ describe("Connection URL Tests", () => {
|
|||
(createMethod: any, recognizerCreateMethod: (
|
||||
config: sdk.SpeechConfig | sdk.SpeechTranslationConfig) => sdk.SpeechRecognizer | sdk.TranslationRecognizer | sdk.IntentRecognizer | sdk.SpeechSynthesizer) => {
|
||||
test("setServiceProperty (single)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: setServiceProperty (single)");
|
||||
|
||||
const propName: string = "someProperty";
|
||||
|
@ -712,7 +712,7 @@ describe("Connection URL Tests", () => {
|
|||
});
|
||||
|
||||
test("setServiceProperty (change)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: setServiceProperty (change)");
|
||||
|
||||
const propName: string = "someProperty";
|
||||
|
@ -729,7 +729,7 @@ describe("Connection URL Tests", () => {
|
|||
});
|
||||
|
||||
test("setServiceProperty (multiple)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: setServiceProperty (multiple)");
|
||||
|
||||
const propName: string = "someProperty";
|
||||
|
@ -748,7 +748,7 @@ describe("Connection URL Tests", () => {
|
|||
});
|
||||
|
||||
test("setProfanity", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: setProfanity");
|
||||
|
||||
const propName: string = "profanity";
|
||||
|
@ -765,7 +765,7 @@ describe("Connection URL Tests", () => {
|
|||
});
|
||||
|
||||
test("enableAudioLogging", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: enableAudioLogging");
|
||||
|
||||
const propName: string = "storeAudio";
|
||||
|
@ -782,7 +782,7 @@ describe("Connection URL Tests", () => {
|
|||
});
|
||||
|
||||
test("requestWordLevelTimestamps", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: requestWordLevelTimestamps");
|
||||
|
||||
const propName: string = "wordLevelTimestamps";
|
||||
|
@ -799,7 +799,7 @@ describe("Connection URL Tests", () => {
|
|||
});
|
||||
|
||||
test("initialSilenceTimeoutMs", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: initialSilenceTimeoutMs");
|
||||
|
||||
const propName: string = "initialSilenceTimeoutMs";
|
||||
|
@ -816,7 +816,7 @@ describe("Connection URL Tests", () => {
|
|||
});
|
||||
|
||||
test("endSilenceTimeoutMs", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: endSilenceTimeoutMs");
|
||||
|
||||
const propName: string = "endSilenceTimeoutMs";
|
||||
|
@ -833,7 +833,7 @@ describe("Connection URL Tests", () => {
|
|||
});
|
||||
|
||||
test("stableIntermediateThreshold", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: stableIntermediateThreshold");
|
||||
|
||||
const propName: string = "stableIntermediateThreshold";
|
||||
|
@ -851,7 +851,7 @@ describe("Connection URL Tests", () => {
|
|||
});
|
||||
|
||||
test("enableDictation (Speech)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: enableDictation");
|
||||
|
||||
const s: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription(Settings.SpeechSubscriptionKey, Settings.SpeechRegion);
|
||||
|
|
|
@ -15,7 +15,7 @@ beforeAll(() => {
|
|||
Settings.LoadSettings();
|
||||
});
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
beforeEach(() => console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------"));
|
||||
|
||||
test("Emtpy returns empty", () => {
|
||||
|
|
|
@ -32,19 +32,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -100,7 +100,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
|
||||
describe("Intiial Silence Tests", () => {
|
||||
test("InitialSilenceTimeout (pull)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialSilenceTimeout (pull)");
|
||||
let p: sdk.PullAudioInputStream;
|
||||
let bytesSent: number = 0;
|
||||
|
@ -131,7 +131,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 15000);
|
||||
|
||||
test("InitialSilenceTimeout (push)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialSilenceTimeout (push)");
|
||||
const p: sdk.PushAudioInputStream = sdk.AudioInputStream.createPushStream();
|
||||
const bigFileBuffer: Uint8Array = new Uint8Array(1024 * 1024);
|
||||
|
@ -144,7 +144,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 15000);
|
||||
|
||||
Settings.testIfDOMCondition("InitialSilenceTimeout (File)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialSilenceTimeout (File)");
|
||||
const audioFormat: AudioStreamFormatImpl = sdk.AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl;
|
||||
const bigFileBuffer: Uint8Array = new Uint8Array(1024 * 1024);
|
||||
|
@ -226,7 +226,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
};
|
||||
|
||||
test.skip("InitialBabbleTimeout", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialBabbleTimeout");
|
||||
|
||||
const s: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription(Settings.SpeechSubscriptionKey, Settings.SpeechRegion);
|
||||
|
@ -272,7 +272,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("burst of silence", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: burst of silence");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -322,7 +322,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("InitialSilenceTimeout Continuous", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialSilenceTimeout Continuous");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -380,7 +380,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 30000);
|
||||
|
||||
test("Silence After Speech", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Silence After Speech");
|
||||
// Pump valid speech and then silence until at least one speech end cycle hits.
|
||||
const p: sdk.PushAudioInputStream = sdk.AudioInputStream.createPushStream();
|
||||
|
@ -461,7 +461,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 30000);
|
||||
|
||||
test("Silence Then Speech", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Silence Then Speech");
|
||||
// Pump valid speech and then silence until at least one speech end cycle hits.
|
||||
const p: sdk.PushAudioInputStream = sdk.AudioInputStream.createPushStream();
|
||||
|
|
|
@ -59,19 +59,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -117,7 +117,7 @@ const BuildSpeechConfig: () => sdk.SpeechConfig = (): sdk.SpeechConfig => {
|
|||
|
||||
/*
|
||||
test("speech.event from service", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: speech.event from service");
|
||||
|
||||
expect(Settings.VoiceSignatureEnrollmentEndpoint && Settings.VoiceSignatureEnrollmentEndpoint.length > 0);
|
||||
|
@ -158,7 +158,7 @@ test("speech.event from service", (done: jest.DoneCallback) => {
|
|||
|
||||
let receivedSpeechEvent: boolean = false;
|
||||
connection.receivedServiceMessage = (e: sdk.ServiceEventArgs): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Receuved a Service message: '" + e.jsonString + "'");
|
||||
if ( e.eventName === "speech.event" ) {
|
||||
receivedSpeechEvent = true;
|
||||
|
@ -200,7 +200,7 @@ test("speech.event from service", (done: jest.DoneCallback) => {
|
|||
}, 200000);
|
||||
*/
|
||||
test("testDetailedSpeechPhrase1", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testDetailedSpeechPhrase1");
|
||||
try {
|
||||
const testJsonString: string = `{"Id":"1234","RecognitionStatus":"Success","Offset":1,"Duration":4000000,"DisplayText":"This","NBest":[{"Confidence":0.9,"Lexical":"this","ITN":"this","MaskedITN":"this","Display":"This.","Words":[{"Word":"this","Offset":2,"Duration":4000000}]},{"Confidence":0.0,"Lexical":"","ITN":"","MaskedITN":"","Display":""}]}`;
|
||||
|
@ -214,7 +214,7 @@ test("testDetailedSpeechPhrase1", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("testSpeechRecognizer1", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechRecognizer1");
|
||||
const speechConfig: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription(Settings.SpeechSubscriptionKey, Settings.SpeechRegion);
|
||||
expect(speechConfig).not.toBeUndefined();
|
||||
|
@ -230,7 +230,7 @@ test("testSpeechRecognizer1", () => {
|
|||
});
|
||||
|
||||
test("testGetLanguage1", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testGetLanguage1");
|
||||
const r: sdk.SpeechRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -239,7 +239,7 @@ test("testGetLanguage1", () => {
|
|||
});
|
||||
|
||||
test("testGetLanguage2", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testGetLanguage2");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -255,7 +255,7 @@ test("testGetLanguage2", () => {
|
|||
});
|
||||
|
||||
test("testGetOutputFormatDefault", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testGetOutputFormatDefault");
|
||||
const r: sdk.SpeechRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -264,7 +264,7 @@ test("testGetOutputFormatDefault", () => {
|
|||
});
|
||||
|
||||
test("testGetParameters", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testGetParameters");
|
||||
const r: sdk.SpeechRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -277,7 +277,7 @@ test("testGetParameters", () => {
|
|||
});
|
||||
|
||||
test("BadWavFileProducesError", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: BadWavFileProducesError");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -317,7 +317,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("44Khz Wave File", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: 44Khz Wave File");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -356,7 +356,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("testGetOutputFormatDetailed", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testGetOutputFormatDetailed");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -395,7 +395,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("testGetOutputFormatDetailed with authorization token", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testGetOutputFormatDetailed");
|
||||
|
||||
const req = {
|
||||
|
@ -457,7 +457,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("fromEndPoint with Subscription key", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: fromEndPoint with Subscription key");
|
||||
|
||||
const endpoint = "wss://" + Settings.SpeechRegion + ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1";
|
||||
|
@ -503,7 +503,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("RecognizeOnce", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: RecognizeOnce");
|
||||
|
||||
const r: sdk.SpeechRecognizer = BuildRecognizerFromWaveFile();
|
||||
|
@ -574,7 +574,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("testStopContinuousRecognitionAsyncWithTelemetry", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testStopContinuousRecognitionAsyncWithTelemetry");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -664,7 +664,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Event Tests (RecognizeOnce)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Event Tests (RecognizeOnce)");
|
||||
const SpeechStartDetectedEvent = "SpeechStartDetectedEvent";
|
||||
const SpeechEndDetectedEvent = "SpeechEndDetectedEvent";
|
||||
|
@ -698,7 +698,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
// todo eventType should be renamed and be a function getEventType()
|
||||
r.speechStartDetected = (o: sdk.Recognizer, e: sdk.RecognitionEventArgs) => {
|
||||
const now: number = eventIdentifier++;
|
||||
// tslint:disable-next-line:no-string-literal
|
||||
// eslint-disable-next-line no-string-literal
|
||||
eventsMap[SpeechStartDetectedEvent] = now;
|
||||
};
|
||||
r.speechEndDetected = (o: sdk.Recognizer, e: sdk.RecognitionEventArgs) => {
|
||||
|
@ -784,7 +784,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Event Tests (Continuous)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Event Tests (Continuous)");
|
||||
const SpeechStartDetectedEvent = "SpeechStartDetectedEvent";
|
||||
const SpeechEndDetectedEvent = "SpeechEndDetectedEvent";
|
||||
|
@ -822,7 +822,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
// todo eventType should be renamed and be a function getEventType()
|
||||
r.speechStartDetected = (o: sdk.Recognizer, e: sdk.RecognitionEventArgs) => {
|
||||
const now: number = eventIdentifier++;
|
||||
// tslint:disable-next-line:no-string-literal
|
||||
// eslint-disable-next-line no-string-literal
|
||||
eventsMap[SpeechStartDetectedEvent] = now;
|
||||
};
|
||||
r.speechEndDetected = (o: sdk.Recognizer, e: sdk.RecognitionEventArgs) => {
|
||||
|
@ -910,7 +910,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
afterEach(() => sdk.Recognizer.enableTelemetry(true));
|
||||
|
||||
test("testStopContinuousRecognitionAsyncWithoutTelemetry", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testStopContinuousRecognitionAsyncWithoutTelemetry");
|
||||
// start with telemetry disabled
|
||||
const r: sdk.SpeechRecognizer = BuildRecognizerFromWaveFile();
|
||||
|
@ -967,14 +967,14 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Close with no recognition", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Close with no recognition");
|
||||
const r: sdk.SpeechRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
});
|
||||
|
||||
test("Config is copied on construction", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Config is copied on construction");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -1007,7 +1007,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("PushStream4KNoDelay", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: PushStream4KNoDelay");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1062,7 +1062,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Detailed output continuous recognition stops correctly", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Detailed output continuous recognition stops correctly");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1088,7 +1088,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 15000);
|
||||
|
||||
test("PushStream start-stop-start continuous recognition on PushStream", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: PushStream start-stop-start continuous recognition on PushStream");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1141,7 +1141,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 15000);
|
||||
|
||||
test("PushStream44K, muLaw, Alaw files", async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: PushStream44K, muLaw, Alaw files");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1202,7 +1202,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("PushStream4KPostRecognizePush", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: PushStream4KPostRecognizePush");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1257,7 +1257,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("PullStreamFullFill", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: PullStreamFullFill");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1322,7 +1322,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("PullStream44K", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: PullStream44K");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1388,7 +1388,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 120000);
|
||||
|
||||
test("PullStreamHalfFill", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: PullStreamHalfFill");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1454,7 +1454,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test.skip("emptyFile", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: emptyFile");
|
||||
// Server Responses:
|
||||
// turn.start {"context": { "serviceTag": "<tag>" }}
|
||||
|
@ -1513,7 +1513,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("PullStreamSendHalfTheFile", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: PullStreamSendHalfTheFile");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1576,7 +1576,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("RecognizeOnceAsync is async", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: RecognizeOnceAsync is async");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1621,7 +1621,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 100000);
|
||||
|
||||
test("Audio Config is optional", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Audio Config is optional");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1632,7 +1632,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
Settings.testIfDOMCondition("Default mic is used when audio config is not specified.", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Default mic is used when audio config is not specified.");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1657,7 +1657,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Using disposed recognizer invokes error callbacks.", async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Using disposed recognizer invokes error callbacks.");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1781,7 +1781,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Endpoint URL With Parameter Test", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Endpoint URL With Parameter Test");
|
||||
|
||||
const s: sdk.SpeechConfig = sdk.SpeechConfig.fromEndpoint(new URL("wss://fake.host.name?somequeryParam=Value"), "fakekey");
|
||||
|
@ -1811,7 +1811,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 100000);
|
||||
|
||||
test("Endpoint URL With Auth Token Bearer added", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Endpoint URL With Auth Token Bearer added");
|
||||
|
||||
const fakeToken: string = createNoDashGuid();
|
||||
|
@ -1843,7 +1843,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Connection Errors Propogate Async", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Connection Errors Propogate Async");
|
||||
const s: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription("badKey", Settings.SpeechRegion);
|
||||
objsToClose.push(s);
|
||||
|
@ -1865,7 +1865,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Connection Errors Propogate Sync", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Connection Errors Propogate Sync");
|
||||
const s: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription("badKey", Settings.SpeechRegion);
|
||||
objsToClose.push(s);
|
||||
|
@ -1902,7 +1902,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 100000);
|
||||
|
||||
test("RecognizeOnce Bad Language", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: RecognizeOnce Bad Language");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -1940,7 +1940,7 @@ describe.each([true])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
Settings.testIfDOMCondition("Push Stream Async", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Push Stream Async");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -1980,7 +1980,7 @@ Settings.testIfDOMCondition("Push Stream Async", (done: jest.DoneCallback) => {
|
|||
}, 10000);
|
||||
|
||||
test("Multiple RecognizeOnce calls share a connection", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Multiple RecognizeOnce calls share a connection");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -2090,7 +2090,7 @@ test("Multiple RecognizeOnce calls share a connection", (done: jest.DoneCallback
|
|||
}, 15000);
|
||||
|
||||
test("Multiple ContReco calls share a connection", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Multiple ContReco calls share a connection");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -2158,7 +2158,7 @@ test("Multiple ContReco calls share a connection", (done: jest.DoneCallback) =>
|
|||
|
||||
r.canceled = (r: sdk.Recognizer, e: sdk.SpeechRecognitionCanceledEventArgs): void => {
|
||||
try {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(e);
|
||||
expect(e.errorDetails).toBeUndefined();
|
||||
} catch (error) {
|
||||
|
@ -2214,7 +2214,7 @@ test("Multiple ContReco calls share a connection", (done: jest.DoneCallback) =>
|
|||
}, 20000);
|
||||
|
||||
test("StopContinous Reco does", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: StopContinous Reco does");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
@ -2330,7 +2330,7 @@ test("StopContinous Reco does", (done: jest.DoneCallback) => {
|
|||
|
||||
describe("PhraseList tests", () => {
|
||||
test("Ambiguous Speech default as expected", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Ambiguous Speech default as expected");
|
||||
|
||||
const r: sdk.SpeechRecognizer = BuildRecognizerFromWaveFile(undefined, Settings.AmbiguousWaveFile);
|
||||
|
@ -2364,7 +2364,7 @@ describe("PhraseList tests", () => {
|
|||
|
||||
// This test validates our ability to add features to the SDK in parallel / ahead of implementation by the Speech Service with no ill effects.
|
||||
test("Service accepts random speech.context sections w/o error", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Service accepts random speech.context sections w/o error.");
|
||||
|
||||
const r: sdk.SpeechRecognizer = BuildRecognizerFromWaveFile(undefined, Settings.AmbiguousWaveFile);
|
||||
|
@ -2400,7 +2400,7 @@ describe("PhraseList tests", () => {
|
|||
});
|
||||
|
||||
test("Phraselist assists speech Reco.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Phraselist assists speech Reco.");
|
||||
|
||||
const r: sdk.SpeechRecognizer = BuildRecognizerFromWaveFile(undefined, Settings.AmbiguousWaveFile);
|
||||
|
@ -2436,7 +2436,7 @@ describe("PhraseList tests", () => {
|
|||
});
|
||||
|
||||
test("Phraselist extra phraselists have no effect.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Phraselist extra phraselists have no effect.");
|
||||
|
||||
const r: sdk.SpeechRecognizer = BuildRecognizerFromWaveFile(undefined, Settings.AmbiguousWaveFile);
|
||||
|
@ -2474,7 +2474,7 @@ describe("PhraseList tests", () => {
|
|||
|
||||
test("Phraselist Clear works.", (done: jest.DoneCallback) => {
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Phraselist Clear works.");
|
||||
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
|
|
@ -25,19 +25,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -132,7 +132,7 @@ class PushAudioOutputStreamTestCallback extends sdk.PushAudioOutputStreamCallbac
|
|||
}
|
||||
|
||||
test("testGetVoicesAsyncAuthError", async () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testGetVoicesAsyncAuthError");
|
||||
const speechConfig: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription("foo", Settings.SpeechRegion);
|
||||
|
||||
|
@ -149,7 +149,7 @@ test("testGetVoicesAsyncAuthError", async () => {
|
|||
});
|
||||
|
||||
test("testGetVoicesAsyncDefault", async () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testGetVoicesAsyncDefault");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
||||
|
@ -165,7 +165,7 @@ test("testGetVoicesAsyncDefault", async () => {
|
|||
});
|
||||
|
||||
test("testGetVoicesAsyncUS", async () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testGetVoicesAsyncUS");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
||||
|
@ -183,7 +183,7 @@ test("testGetVoicesAsyncUS", async () => {
|
|||
});
|
||||
|
||||
Settings.testIfDOMCondition("testSpeechSynthesizer1", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizer1");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
|
||||
|
@ -198,7 +198,7 @@ Settings.testIfDOMCondition("testSpeechSynthesizer1", () => {
|
|||
});
|
||||
|
||||
test("testSetAndGetParameters", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSetAndGetParameters");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
speechConfig.speechSynthesisLanguage = "zh-CN";
|
||||
|
@ -219,7 +219,7 @@ test("testSetAndGetParameters", () => {
|
|||
describe("Service based tests", () => {
|
||||
|
||||
test("testSpeechSynthesizerEvent1", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizerEvent1");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -236,7 +236,7 @@ describe("Service based tests", () => {
|
|||
let completeEventCount: number = 0;
|
||||
|
||||
s.synthesisStarted = (o: sdk.SpeechSynthesizer, e: sdk.SpeechSynthesisEventArgs): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Synthesis started.");
|
||||
try {
|
||||
CheckSynthesisResult(e.result, sdk.ResultReason.SynthesizingAudioStarted);
|
||||
|
@ -247,7 +247,7 @@ describe("Service based tests", () => {
|
|||
};
|
||||
|
||||
s.synthesizing = (o: sdk.SpeechSynthesizer, e: sdk.SpeechSynthesisEventArgs): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Audio received with length of " + e.result.audioData.byteLength);
|
||||
audioLength += e.result.audioData.byteLength - 44;
|
||||
try {
|
||||
|
@ -259,7 +259,7 @@ describe("Service based tests", () => {
|
|||
};
|
||||
|
||||
s.synthesisCompleted = (o: sdk.SpeechSynthesizer, e: sdk.SpeechSynthesisEventArgs): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Audio received with length of " + e.result.audioData.byteLength);
|
||||
try {
|
||||
CheckSynthesisResult(e.result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
|
@ -292,7 +292,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizerSpeakTwice", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizerSpeakTwice");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -304,7 +304,7 @@ describe("Service based tests", () => {
|
|||
expect(s).not.toBeUndefined();
|
||||
|
||||
s.speakTextAsync("hello world 1.", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking finished, turn 1");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
// To seconds
|
||||
|
@ -314,7 +314,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
s.speakTextAsync("hello world 2.", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking finished, turn 2");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
expect(result.audioDuration / 1000 / 1000 / 10).toBeCloseTo(result.audioData.byteLength / 32000, 2);
|
||||
|
@ -325,7 +325,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizerToFile", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizerToFile");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -341,7 +341,7 @@ describe("Service based tests", () => {
|
|||
let audioLength: number = 0;
|
||||
|
||||
s.speakTextAsync("hello world 1.", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking finished, turn 1");
|
||||
audioLength += result.audioData.byteLength;
|
||||
}, (e: string): void => {
|
||||
|
@ -349,7 +349,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
s.speakTextAsync("hello world 2.", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking finished, turn 2");
|
||||
audioLength += result.audioData.byteLength;
|
||||
s.close();
|
||||
|
@ -365,7 +365,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizer: synthesis to file in turn.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizer synthesis to file in turn.");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
speechConfig.speechSynthesisOutputFormat = sdk.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3;
|
||||
|
@ -376,7 +376,7 @@ describe("Service based tests", () => {
|
|||
objsToClose.push(s);
|
||||
|
||||
s.speakTextAsync("hello world.", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking finished.");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
// wait 2 seconds before checking file size, as the async file writing might not be finished right now.
|
||||
|
@ -391,7 +391,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizerWordBoundary", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizerWordBoundary");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -527,7 +527,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizerBookmark", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizerBookmark");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -565,7 +565,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizerViseme", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizerViseme");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -602,7 +602,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizer: synthesis with SSML.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizer synthesis with SSML.");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -614,7 +614,7 @@ describe("Service based tests", () => {
|
|||
|
||||
let r: sdk.SpeechSynthesisResult;
|
||||
s.speakTextAsync("hello world.", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking text finished.");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
r = result;
|
||||
|
@ -626,7 +626,7 @@ describe("Service based tests", () => {
|
|||
`<speak version='1.0' xml:lang='en-US' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='http://www.w3.org/2001/mstts'>
|
||||
<voice name='Microsoft Server Speech Text to Speech Voice (en-US, AriaRUS)'>hello world.</voice></speak>`;
|
||||
s.speakSsmlAsync(ssml, (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking ssml finished.");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
CheckBinaryEqual(r.audioData, result.audioData);
|
||||
|
@ -637,7 +637,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
Settings.testIfDOMCondition("testSpeechSynthesizer: synthesis with invalid key.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizer synthesis with invalid key.");
|
||||
const speechConfig: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription("invalidKey", Settings.SpeechRegion);
|
||||
expect(speechConfig).not.toBeUndefined();
|
||||
|
@ -672,7 +672,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizer: synthesis with invalid voice name.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizer synthesis with invalid voice name.");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -720,7 +720,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizer: synthesis to pull audio output stream.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizer synthesis to pull audio output stream.");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -737,7 +737,7 @@ describe("Service based tests", () => {
|
|||
expect(s).not.toBeUndefined();
|
||||
|
||||
s.speakTextAsync("hello world.", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking text finished.");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
s.close();
|
||||
|
@ -747,7 +747,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizer: synthesis to pull audio output stream 2.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizer synthesis to pull audio output stream 2.");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -761,7 +761,7 @@ describe("Service based tests", () => {
|
|||
expect(s).not.toBeUndefined();
|
||||
|
||||
s.speakTextAsync("hello world.", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking text finished.");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
s.close();
|
||||
|
@ -772,7 +772,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
Settings.testIfDOMCondition("testSpeechSynthesizer: synthesis to push audio output stream.", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizer synthesis to push audio output stream.");
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
|
@ -785,7 +785,7 @@ describe("Service based tests", () => {
|
|||
expect(s).not.toBeUndefined();
|
||||
|
||||
s.speakTextAsync("hello world.", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking text finished.");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
s.close();
|
||||
|
@ -798,7 +798,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizer: authentication with authorization token", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizer authentication with authorization token");
|
||||
|
||||
const req = {
|
||||
|
@ -833,7 +833,7 @@ describe("Service based tests", () => {
|
|||
objsToClose.push(s);
|
||||
|
||||
s.speakTextAsync("hello world.", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking text finished.");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
done();
|
||||
|
@ -843,9 +843,10 @@ describe("Service based tests", () => {
|
|||
});
|
||||
});
|
||||
|
||||
test("test Speech Synthesizer: Language Auto Detection", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.info("Name: test Speech Synthesizer, Language Auto Detection");
|
||||
test("test Speech Synthesiser: Language Auto Detection", (done: jest.DoneCallback) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: test Speech Synthesiser, Language Auto Detection");
|
||||
|
||||
const speechConfig: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(speechConfig);
|
||||
const autoDetectSourceLanguageConfig: sdk.AutoDetectSourceLanguageConfig = sdk.AutoDetectSourceLanguageConfig.fromOpenRange();
|
||||
|
@ -873,7 +874,7 @@ describe("Service based tests", () => {
|
|||
|
||||
// we will get very short audio as the en-US voices are not mix-lingual.
|
||||
s.speakTextAsync("你好世界。", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking finished, turn 1");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
expect(result.audioData.byteLength).toBeGreaterThan(64 << 7); // longer than 1s
|
||||
|
@ -882,7 +883,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
s.speakTextAsync("今天天气很好。", (result: sdk.SpeechSynthesisResult): void => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("speaking finished, turn 2");
|
||||
CheckSynthesisResult(result, sdk.ResultReason.SynthesizingAudioCompleted);
|
||||
expect(result.audioData.byteLength).toBeGreaterThan(64 << 7); // longer than 1s
|
||||
|
@ -893,7 +894,7 @@ describe("Service based tests", () => {
|
|||
});
|
||||
|
||||
test("testSpeechSynthesizerUsingCustomVoice", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: testSpeechSynthesizerUsingCustomVoice");
|
||||
|
||||
let uri: string;
|
||||
|
|
|
@ -28,19 +28,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// Override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Sart Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -83,7 +83,7 @@ const Canceled: string = "Canceled";
|
|||
let eventIdentifier: number;
|
||||
|
||||
test("TranslationRecognizerMicrophone", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: TranslationRecognizerMicrophone");
|
||||
|
||||
const s: sdk.SpeechTranslationConfig = sdk.SpeechTranslationConfig.fromSubscription(Settings.SpeechSubscriptionKey, Settings.SpeechRegion);
|
||||
|
@ -99,14 +99,14 @@ test("TranslationRecognizerMicrophone", () => {
|
|||
});
|
||||
|
||||
test("TranslationRecognizerWavFile", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: TranslationRecognizerWavFile");
|
||||
const r: sdk.TranslationRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
});
|
||||
|
||||
test("GetSourceLanguage", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: GetSourceLanguage");
|
||||
const r: sdk.TranslationRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -116,7 +116,7 @@ test("GetSourceLanguage", () => {
|
|||
});
|
||||
|
||||
test("GetParameters", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: GetParameters");
|
||||
const r: sdk.TranslationRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -132,7 +132,7 @@ test("GetParameters", () => {
|
|||
describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
||||
|
||||
beforeEach(() => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("forceNodeWebSocket: " + forceNodeWebSocket);
|
||||
WebsocketMessageAdapter.forceNpmWebSocket = forceNodeWebSocket;
|
||||
});
|
||||
|
@ -146,7 +146,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("RecognizeOnceAsync1", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: RecognizeOnceAsync1");
|
||||
const r: sdk.TranslationRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -211,7 +211,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Validate Event Ordering", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Validate Event Ordering");
|
||||
const SpeechStartDetectedEvent = "SpeechStartDetectedEvent";
|
||||
const SpeechEndDetectedEvent = "SpeechEndDetectedEvent";
|
||||
|
@ -331,7 +331,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("StartContinuousRecognitionAsync", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: StartContinuousRecognitionAsync");
|
||||
const r: sdk.TranslationRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -360,7 +360,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("StopContinuousRecognitionAsync", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: StopContinuousRecognitionAsync");
|
||||
const r: sdk.TranslationRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -385,7 +385,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("StartStopContinuousRecognitionAsync", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: StartStopContinuousRecognitionAsync");
|
||||
const r: sdk.TranslationRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -426,7 +426,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("InitialSilenceTimeout (pull)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialSilenceTimeout (pull)");
|
||||
let p: sdk.PullAudioInputStream;
|
||||
let bytesSent: number = 0;
|
||||
|
@ -457,7 +457,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 15000);
|
||||
|
||||
test("InitialSilenceTimeout (push)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialSilenceTimeout (push)");
|
||||
const p: sdk.PushAudioInputStream = sdk.AudioInputStream.createPushStream();
|
||||
const bigFileBuffer: Uint8Array = new Uint8Array(1024 * 1024);
|
||||
|
@ -470,7 +470,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 15000);
|
||||
|
||||
Settings.testIfDOMCondition("InitialSilenceTimeout (File)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: InitialSilenceTimeout (File)");
|
||||
const audioFormat: AudioStreamFormatImpl = sdk.AudioStreamFormat.getDefaultInputFormat() as AudioStreamFormatImpl;
|
||||
const bigFileBuffer: Uint8Array = new Uint8Array(1024 * 1024);
|
||||
|
@ -547,7 +547,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
};
|
||||
|
||||
test.skip("emptyFile", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: emptyFile");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -594,7 +594,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Audio Config is optional", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Audio Config is optional");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -609,7 +609,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
Settings.testIfDOMCondition("Default mic is used when audio config is not specified. (once)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Default mic is used when audio config is not specified. (once)");
|
||||
const s: sdk.SpeechTranslationConfig = sdk.SpeechTranslationConfig.fromSubscription(Settings.SpeechSubscriptionKey, Settings.SpeechRegion);
|
||||
expect(s).not.toBeUndefined();
|
||||
|
@ -632,7 +632,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
Settings.testIfDOMCondition("Default mic is used when audio config is not specified. (Cont)", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Default mic is used when audio config is not specified. (Cont)");
|
||||
const s: sdk.SpeechTranslationConfig = sdk.SpeechTranslationConfig.fromSubscription(Settings.SpeechSubscriptionKey, Settings.SpeechRegion);
|
||||
expect(s).not.toBeUndefined();
|
||||
|
@ -655,7 +655,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Connection Errors Propogate Async", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Connection Errors Propogate Async");
|
||||
const s: sdk.SpeechTranslationConfig = sdk.SpeechTranslationConfig.fromSubscription("badKey", Settings.SpeechRegion);
|
||||
objsToClose.push(s);
|
||||
|
@ -677,7 +677,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Connection Errors Propogate Sync", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Connection Errors Propogate Sync");
|
||||
const s: sdk.SpeechTranslationConfig = sdk.SpeechTranslationConfig.fromSubscription("badKey", Settings.SpeechRegion);
|
||||
objsToClose.push(s);
|
||||
|
@ -714,7 +714,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Silence After Speech", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Silence After Speech");
|
||||
// Pump valid speech and then silence until at least one speech end cycle hits.
|
||||
const p: sdk.PushAudioInputStream = sdk.AudioInputStream.createPushStream();
|
||||
|
@ -798,7 +798,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 35000);
|
||||
|
||||
test("Silence Then Speech", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Silence Then Speech");
|
||||
// Pump valid speech and then silence until at least one speech end cycle hits.
|
||||
const p: sdk.PushAudioInputStream = sdk.AudioInputStream.createPushStream();
|
||||
|
@ -891,7 +891,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Multiple Phrase Latency Reporting", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Multiple Phrase Latency Reporting");
|
||||
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
|
|
|
@ -28,19 +28,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// Override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Sart Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -81,7 +81,7 @@ const Recognized: string = "Recognized";
|
|||
const Canceled: string = "Canceled";
|
||||
|
||||
test("GetTargetLanguages", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: GetTargetLanguages");
|
||||
const r: sdk.TranslationRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -93,7 +93,7 @@ test("GetTargetLanguages", () => {
|
|||
});
|
||||
|
||||
test.skip("GetOutputVoiceNameNoSetting", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: GetOutputVoiceNameNoSetting");
|
||||
const r: sdk.TranslationRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -101,7 +101,7 @@ test.skip("GetOutputVoiceNameNoSetting", () => {
|
|||
});
|
||||
|
||||
test("GetParameters", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: GetParameters");
|
||||
const r: sdk.TranslationRecognizer = BuildRecognizerFromWaveFile();
|
||||
objsToClose.push(r);
|
||||
|
@ -117,7 +117,7 @@ test("GetParameters", () => {
|
|||
describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
||||
|
||||
beforeEach(() => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("forceNodeWebSocket: " + forceNodeWebSocket);
|
||||
WebsocketMessageAdapter.forceNpmWebSocket = forceNodeWebSocket;
|
||||
});
|
||||
|
@ -126,7 +126,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("Translate Multiple Targets", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Translate Multiple Targets");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -178,7 +178,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 15000);
|
||||
|
||||
test("Translate Bad Language", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Translate Bad Language");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -217,7 +217,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("RecognizeOnce Bad Language", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: RecognizeOnce Bad Language");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -255,7 +255,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
});
|
||||
|
||||
test("fromEndPoint with Subscription key", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: fromEndPoint with Subscription key");
|
||||
|
||||
const endpoint = "wss://" + Settings.SpeechRegion + ".s2s.speech.microsoft.com/speech/translation/cognitiveservices/v1";
|
||||
|
@ -291,7 +291,7 @@ describe.each([false])("Service based tests", (forceNodeWebSocket: boolean) => {
|
|||
}, 12000);
|
||||
|
||||
test("fromV2EndPoint with Subscription key", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: fromV2EndPoint with Subscription key");
|
||||
|
||||
const endpoint = "wss://" + Settings.SpeechRegion + ".stt.speech.microsoft.com/speech/universal/v2?SpeechContext-translation.targetLanguages=[\"de-de\"]";
|
||||
|
|
|
@ -23,19 +23,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// Override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -71,7 +71,7 @@ const BuildSpeechConfig: () => sdk.SpeechTranslationConfig = (): sdk.SpeechTrans
|
|||
};
|
||||
|
||||
test("GetOutputVoiceName", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: GetOutputVoiceName");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -86,7 +86,7 @@ test("GetOutputVoiceName", () => {
|
|||
});
|
||||
|
||||
test("TranslateVoiceRoundTrip", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: TranslateVoiceRoundTrip");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -196,7 +196,7 @@ test("TranslateVoiceRoundTrip", (done: jest.DoneCallback) => {
|
|||
}, 10000);
|
||||
|
||||
test("TranslateVoiceInvalidVoice", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: TranslateVoiceInvalidVoice");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -245,7 +245,7 @@ test("TranslateVoiceInvalidVoice", (done: jest.DoneCallback) => {
|
|||
});
|
||||
|
||||
test("TranslateVoiceUSToGerman", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: TranslateVoiceUSToGerman");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -360,7 +360,7 @@ test("TranslateVoiceUSToGerman", (done: jest.DoneCallback) => {
|
|||
}, 10000);
|
||||
|
||||
test("MultiPhrase", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: MultiPhrase");
|
||||
const s: sdk.SpeechTranslationConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -515,7 +515,7 @@ test("MultiPhrase", (done: jest.DoneCallback) => {
|
|||
}, 45000);
|
||||
|
||||
test("Config is copied on construction", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Config is copied on construction");
|
||||
const s: sdk.SpeechTranslationConfig = sdk.SpeechTranslationConfig.fromSubscription(Settings.SpeechSubscriptionKey, Settings.SpeechRegion);
|
||||
expect(s).not.toBeUndefined();
|
||||
|
|
|
@ -20,19 +20,19 @@ let objsToClose: any[];
|
|||
beforeAll(() => {
|
||||
// Override inputs, if necessary
|
||||
Settings.LoadSettings();
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(EventType.Debug));
|
||||
Events.instance.attachListener(new ConsoleLoggingListener(sdk.LogLevel.Debug));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
objsToClose = [];
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("------------------Starting test case: " + expect.getState().currentTestName + "-------------------------");
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Start Time: " + new Date(Date.now()).toLocaleString());
|
||||
});
|
||||
|
||||
afterEach(async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("End Time: " + new Date(Date.now()).toLocaleString());
|
||||
await closeAsyncObjects(objsToClose);
|
||||
done();
|
||||
|
@ -76,14 +76,14 @@ const BuildRecognizer: (speechConfig?: sdk.SpeechConfig) => sdk.SpeakerRecognize
|
|||
};
|
||||
|
||||
test("VoiceProfileClient", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: VoiceProfileClient");
|
||||
const r: sdk.VoiceProfileClient = BuildClient();
|
||||
objsToClose.push(r);
|
||||
});
|
||||
|
||||
test("VoiceProfileClient with Bad credentials throws meaningful error", async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: VoiceProfileClient with Bad credentials throws meaningful error");
|
||||
const s: sdk.SpeechConfig = sdk.SpeechConfig.fromSubscription("BADKEY", Settings.SpeakerIDRegion);
|
||||
objsToClose.push(s);
|
||||
|
@ -103,7 +103,7 @@ test("VoiceProfileClient with Bad credentials throws meaningful error", async (d
|
|||
});
|
||||
|
||||
test("GetParameters", () => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: GetParameters");
|
||||
const r: sdk.VoiceProfileClient = BuildClient();
|
||||
objsToClose.push(r);
|
||||
|
@ -112,7 +112,7 @@ test("GetParameters", () => {
|
|||
});
|
||||
|
||||
test("Get Authorization Phrases for enrollment", async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Get Authorization Phrases for enrollment");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -134,7 +134,7 @@ test("Get Authorization Phrases for enrollment", async (done: jest.DoneCallback)
|
|||
}, 20000);
|
||||
|
||||
test("Get Activation Phrases for enrollment", (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Get Activation Phrases for enrollment");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -160,7 +160,7 @@ test("Get Activation Phrases for enrollment", (done: jest.DoneCallback) => {
|
|||
|
||||
test("Create and Delete Voice Profile using push stream - Independent Identification", async (done: jest.DoneCallback) => {
|
||||
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Create and Delete Voice Profile using push stream - Independent Identification");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -218,7 +218,7 @@ test("Create and Delete Voice Profile using push stream - Independent Identifica
|
|||
}, 40000);
|
||||
|
||||
test("Create and Delete Voice Profile - Independent Identification", async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Create and Delete Voice Profile - Independent Identification");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -269,7 +269,7 @@ test("Create and Delete Voice Profile - Independent Identification", async (done
|
|||
}, 15000);
|
||||
|
||||
test("Create and Delete Voice Profile - Independent Verification", async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Create and Delete Voice Profile - Independent Verification");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -319,7 +319,7 @@ test("Create and Delete Voice Profile - Independent Verification", async (done:
|
|||
}, 15000);
|
||||
|
||||
test("Create, Get, and Delete Voice Profile - Independent Verification", async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Create, Get, and Delete Voice Profile - Independent Verification");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
@ -369,7 +369,7 @@ test("Create, Get, and Delete Voice Profile - Independent Verification", async (
|
|||
}, 15000);
|
||||
|
||||
test("Create and Delete Voice Profile - Dependent Verification", async (done: jest.DoneCallback) => {
|
||||
// tslint:disable-next-line:no-console
|
||||
// eslint-disable-next-line no-console
|
||||
console.info("Name: Create and Delete Voice Profile - Dependent Verification");
|
||||
const s: sdk.SpeechConfig = BuildSpeechConfig();
|
||||
objsToClose.push(s);
|
||||
|
|
Загрузка…
Ссылка в новой задаче