microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
test/localization/index.ts
38lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. |
| 3 | |
| 4 | import * as path from "path"; |
| 5 | import Mocha = require("mocha"); |
| 6 | |
| 7 | export async function run(): Promise<void> { |
| 8 | const mocha = new Mocha({ |
| 9 | ui: "tdd", |
| 10 | grep: RegExp("localizationContext"), |
| 11 | reporter: "mocha-multi-reporters", |
| 12 | reporterOptions: { |
| 13 | reporterEnabled: "spec, mocha-junit-reporter", |
| 14 | mochaJunitReporterReporterOptions: { |
| 15 | mochaFile: path.join(__dirname, "..", "LocalizationTests.xml"), |
| 16 | }, |
| 17 | }, |
| 18 | color: true, |
| 19 | }); |
| 20 | |
| 21 | // Register Mocha options |
| 22 | return new Promise((resolve, reject) => { |
| 23 | mocha.addFile(path.resolve(__dirname, "localization.test.js")); |
| 24 | |
| 25 | try { |
| 26 | // Run the mocha test |
| 27 | mocha.run((failures: any) => { |
| 28 | if (failures > 0) { |
| 29 | reject(new Error(`${failures} tests failed.`)); |
| 30 | } else { |
| 31 | resolve(); |
| 32 | } |
| 33 | }); |
| 34 | } catch (err) { |
| 35 | reject(err); |
| 36 | } |
| 37 | }); |
| 38 | } |
| 39 | |