Cordova camera plugin will be added via gulp task that executes before launching the tests
This commit is contained in:
Родитель
ae28f8bf2d
Коммит
68c5773409
|
@ -4,5 +4,6 @@ out/
|
|||
debugger/testCordovaApp/plugins/
|
||||
debugger/testCordovaApp/platforms/
|
||||
debugger/testCordovaApp/.vscode/
|
||||
test/testProject/.vscode
|
||||
test/testProject/platforms
|
||||
test/testProject/.vscode/
|
||||
test/testProject/platforms/
|
||||
test/testProject/plugins/
|
|
@ -21,7 +21,7 @@
|
|||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
"outDir": "out/test",
|
||||
"preLaunchTask": "build"
|
||||
"preLaunchTask": "prepare-integration-tests"
|
||||
},
|
||||
{
|
||||
"name": "Launch debugger as server",
|
||||
|
|
39
gulpfile.js
39
gulpfile.js
|
@ -2,13 +2,37 @@
|
|||
* Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*--------------------------------------------------------*/
|
||||
|
||||
var child_process = require('child_process');
|
||||
var gulp = require('gulp');
|
||||
var path = require('path');
|
||||
var mocha = require('gulp-mocha');
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
var ts = require('gulp-typescript');
|
||||
var log = require('gulp-util').log;
|
||||
var os = require('os');
|
||||
var path = require('path');
|
||||
var Q = require('q');
|
||||
var typescript = require('typescript');
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
var mocha = require('gulp-mocha');
|
||||
|
||||
function executeCordovaCommand(cwd, command) {
|
||||
var deferred = Q.defer();
|
||||
var cordovaCmd = os.platform() === "darwin" ? "cordova" : "cordova.cmd";
|
||||
var commandToExecute = cordovaCmd + " " + command;
|
||||
var process = child_process.exec(commandToExecute, { cwd: cwd });
|
||||
process.on("error", function (err) {
|
||||
console.log("Executing cordova command failed with error: " + err);
|
||||
deferred.reject(err);
|
||||
});
|
||||
process.stdout.on("close", function (exitCode) {
|
||||
if (exitCode) {
|
||||
console.log("Cordova command failed with exit code " + exitCode);
|
||||
deferred.reject(exitCode);
|
||||
}
|
||||
else {
|
||||
deferred.resolve({});
|
||||
}
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
var sources = [
|
||||
'src',
|
||||
|
@ -46,6 +70,11 @@ gulp.task('default', ['build']);
|
|||
|
||||
// Don't lint code from tsd or common, and whitelist my files under adapter
|
||||
var lintSources = [
|
||||
'src/cordova.ts',
|
||||
'src/utils/cordovaCommandHelper.ts',
|
||||
'src/utils/cordovaProjectHelper.ts',
|
||||
'src/utils/tsdHelper.ts',
|
||||
'debugger/test',
|
||||
'debugger/test',
|
||||
'debugger/webkit',
|
||||
'debugger/cordova',
|
||||
|
@ -76,6 +105,10 @@ function test() {
|
|||
gulp.task('build-test', ['build'], test);
|
||||
gulp.task('test', test);
|
||||
|
||||
gulp.task('prepare-integration-tests', ['build'], function() {
|
||||
return executeCordovaCommand(path.resolve(__dirname, "test", "testProject"), "plugin add cordova-plugin-camera");
|
||||
});
|
||||
|
||||
gulp.task('watch-build-test', ['build', 'build-test'], function() {
|
||||
return gulp.watch(sources, ['build', 'build-test']);
|
||||
});
|
||||
|
|
|
@ -28,6 +28,9 @@ suite("VSCode Cordova extension - intellisense and command palette tests", () =>
|
|||
if (fs.existsSync(vsCodeDir)) {
|
||||
rimraf.sync(vsCodeDir);
|
||||
}
|
||||
|
||||
// Remove the camera and whitelist plugins from the testProject
|
||||
return testUtils.removeCordovaComponents("plugin", testProjectPath, ["cordova-plugin-camera", "cordova-plugin-whitelist"])
|
||||
});
|
||||
|
||||
function checkTypeDefinitions(expectedTypedDefs: string[])
|
||||
|
|
|
@ -28,9 +28,8 @@ export function executeCordovaCommand(cwd: string, command: string): Q.Promise<a
|
|||
let cordovaCmd = os.platform() === "darwin" ? "cordova" : "cordova.cmd";
|
||||
let commandToExecute = cordovaCmd + " " + command;
|
||||
let process = child_process.exec(commandToExecute, {cwd: cwd});
|
||||
|
||||
|
||||
process.on("error", function(err: any): void {
|
||||
// ENOENT error will be thrown if no Cordova.cmd is found
|
||||
deferred.reject(err);
|
||||
});
|
||||
process.stdout.on("close", exitCode => {
|
||||
|
@ -40,7 +39,7 @@ export function executeCordovaCommand(cwd: string, command: string): Q.Promise<a
|
|||
deferred.resolve({});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
@ -61,7 +60,7 @@ export function removeCordovaComponents(componentName: string, projectRoot: stri
|
|||
|
||||
export function enumerateListOfTypeDefinitions(projectRoot: string): string[] {
|
||||
let typeDefsFolder = CordovaProjectHelper.getCordovaPluginTypeDefsPath(projectRoot);
|
||||
|
||||
|
||||
// look for all the type defs in the typings folder
|
||||
if (!fs.existsSync(typeDefsFolder)) {
|
||||
return [];
|
||||
|
|
Загрузка…
Ссылка в новой задаче