utils.ts 778 字节
Newer Older
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

6
import { Suite, Context } from 'mocha';
7

8
export function describeRepeat(n: number, description: string, callback: (this: Suite) => void): void {
9 10 11 12 13
	for (let i = 0; i < n; i++) {
		describe(`${description} (iteration ${i})`, callback);
	}
}

14
export function itRepeat(n: number, description: string, callback: (this: Context) => any): void {
15 16 17 18
	for (let i = 0; i < n; i++) {
		it(`${description} (iteration ${i})`, callback);
	}
}