Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbommarito committed May 7, 2016
1 parent 1a93d6a commit 5a473ef
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
28 changes: 14 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

## TypeScript

All the JS code in this plugin is compiled from TypeScript sources. Please do not submit pull requests with direct changes to the JS files in ```bin``` directory.
Instead, modify the sources in the ```www``` folder and compile a new version of the plugin. Read on for more details.
All the JS code in this plugin is compiled from TypeScript sources. Please do not submit pull requests with direct changes to the JS files in `bin` directory.
Instead, modify the sources in the `www` folder and compile a new version of the plugin. Read on for more details.

## Building the plugin

### Environment setup

```node.js``` and ```npm``` are needed for building this project. ```npm``` comes bundled with the ```node.js``` installer. You can download the ```node.js``` installer here: https://nodejs.org/download/.
`node.js` and `npm` are needed for building this project. `npm` comes bundled with the `node.js` installer. You can download the `node.js` installer here: https://nodejs.org/download/.

Once you have installed ```node.js``` and ```npm```, install the dev dependencies for the project.
Once you have installed `node.js` and `npm`, install the dev dependencies for the project.

```
npm install
Expand All @@ -33,21 +33,21 @@ Follow these steps to build a new version of the plugin:
```
gulp
```
This will compile the sources and place them in the ```bin``` folder. Any compilation errors will be displayed in the console.
This will compile the sources and place them in the `bin` folder. Any compilation errors will be displayed in the console.

## Test

### Environment setup

First, make sure you can build the plugin by following the steps above.

Then, make sure you have installed ```Gulp```.
Then, make sure you have installed `gulp`.

```
npm install -g gulp
```

To run Android tests, make sure you have ```sdk\tools``` and ```sdk\platform-tools``` in your PATH.
To run Android tests, make sure you have `sdk\tools` and `sdk\platform-tools` in your PATH.

### Supported platforms

Expand All @@ -64,23 +64,23 @@ The tests first build the app.

They then check if the required emulators are currently running.

If an Android emulator is not running, it attempts to boot an Android emulator named ```emulator```. You can specify an emulator by adding ```--androidemu yourEmulatorNameHere``` as a command line option to the gulp task.
If an Android emulator is not running, it attempts to boot an Android emulator named `emulator`. You can specify an emulator by adding `--androidemu yourEmulatorNameHere` as a command line option to the gulp task.

If an iOS simulator is not running, it attempts to boot the latest iOS iPhone simulator. You can specify a simulator by adding ```--iosemu yourSimulatorNameHere``` as a command line option to the gulp task.
If an iOS simulator is not running, it attempts to boot the latest iOS iPhone simulator. You can specify a simulator by adding `--iosemu yourSimulatorNameHere` as a command line option to the gulp task.

If all the required emulators are not running and the tests fail to boot them, the tests will fail.

If you would like the tests to always restart the necessary emulators (killing them if they are currently running), add a ```--clean``` flag to the command.
If you would like the tests to always restart the necessary emulators (killing them if they are currently running), add a `--clean` flag to the command.

The desired unit tests are then run.

If you would like to skip building, add a ```-fast``` to the end of the command you'd like to run. For example, ```gulp test-ios``` becomes ```gulp test-ios-fast```.
If you would like to skip building, add a `-fast` to the end of the command you'd like to run. For example, `gulp test-ios` becomes `gulp test-ios-fast`.

There is a both a full unit test suite and a "core" set of unit tests that you may run. If you would like to run only the core tests, add a ```--core``` flag to the command.
There is a both a full unit test suite and a "core" set of unit tests that you may run. If you would like to run only the core tests, add a `--core` flag to the command.

If you would like to pull the plugin from NPM rather than running the tests on the local version, add a ```--npm``` flag to the command.
If you would like to pull the plugin from NPM rather than running the tests on the local version, add a `--npm` flag to the command.

The mocha reporter outputs individual results files for each platform. These are ```./test_android.xml```, ```./test-ios-ui.xml```, and ```./test-ios-wk.xml```.
The mocha reporter outputs individual results files for each platform. These are `./test_android.xml`, `./test-ios-ui.xml`, and `./test-ios-wk.xml`.

#### Default

Expand Down
13 changes: 9 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var child_process = require("child_process");
var del = require("del");
var gulp = require("gulp");
var path = require("path");
var child_process = require("child_process");
var Q = require("q");
var runSequence = require("run-sequence");

Expand Down Expand Up @@ -117,11 +118,15 @@ function runTests(callback, options) {
// Set up the mocha junit reporter.
args.push("--reporter");
args.push("mocha-junit-reporter");

// Set the mocha reporter to the correct output file.
args.push("--reporter-options");
if (options.android && !options.ios) args.push("mochaFile=./test-android.xml");
else if (options.ios && !options.android) args.push("mochaFile=./test-ios" + (options.wk ? (options.ui ? "" : "-wk") : "-ui") + ".xml");
else args.push("mochaFile=./test-results.xml");
var filename = "./test-results.xml";
if (options.android && !options.ios) filename = "./test-android.xml";
else if (options.ios && !options.android) filename = "./test-ios" + (options.wk ? (options.ui ? "" : "-wk") : "-ui") + ".xml";
args.push("mochaFile=" + filename);
// Delete previous test result file so TFS doesn't read the old file
del(filename);

// Pass arguments supplied by test tasks.
if (options.android) args.push("--android");
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"peerDependencies": {
"code-push": ">=1.8.0-beta",
"cordova-plugin-file-transfer": ">=1.3.0",
"cordova-plugin-file": ">=3.0.0",
"cordova-plugin-zip": ">=3.0.0",
"cordova-plugin-dialogs": ">=1.1.1",
"cordova-plugin-device": ">=1.1.0"
Expand Down
2 changes: 1 addition & 1 deletion test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function runTests(targetPlatform: platform.IPlatform, useWkWebView: boolean): vo
});

if (!onlyRunCoreTests) {
it("window.codePush.checkForUpdate.noUpdate", function(done) {
it.only("window.codePush.checkForUpdate.noUpdate", function(done) {
var noUpdateResponse = createDefaultResponse();
noUpdateResponse.isAvailable = false;
noUpdateResponse.appVersion = "0.0.1";
Expand Down

0 comments on commit 5a473ef

Please sign in to comment.