appium-gulp-plugins
Custom gulp plugins to be used across all appium modules
Last updated 3 months ago by imurchie .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install appium-gulp-plugins 
SYNC missed versions from official npm registry.

appium-gulp-plugins

Custom plugins used across appium modules

status

Build Status Greenkeeper badge

boilerplate plugin

This plugin sets up all the other typical plugins we use with a simple configuration object.

usage

Basically just set up the boilerplate plugin as follows:

let gulp = require('gulp'),
    boilerplate = require('appium-gulp-plugins').boilerplate.use(gulp);

boilerplate({build: "My Project Name"});

You can pass a lot of options to configure boilerplate. Here are the options along with their defaults (from lib/boilerplate.js):

const DEFAULT_OPTS = {
  files: ['*.js', 'lib/**/*.js', 'test/**/*.js', '!gulpfile.js'],
  transpile: true,
  transpileOut: 'build',
  typescript: false,
  typescriptOpts: {},
  babelOpts: {},
  linkBabelRuntime: true,
  watch: true,
  watchE2E: false,
  test: {
    files: ['${testDir}/**/*-specs.js', '!${testDir}/**/*-e2e-specs.js'],
    traceWarnings: false,
  },
  coverage: {
    files: ['./build/test/**/*-specs.js', '!./build/test/**/*-e2e-specs.js'],
    verbose: true,
  },
  'coverage-e2e': {
    files: ['./build/test/**/*-e2e-specs.js'],
    verbose: true,
  },
  e2eTest: {
    files: ['${testDir}/**/*-e2e-specs.js'],
    forceExit: false,
    traceWarnings: false,
  },
  testReporter: (process.env.TRAVIS || process.env.CI) ? 'spec' : 'nyan',
  testTimeout: 20000,
  build: 'Appium',
  extraPrepublishTasks: [],
  eslint: true,
  eslintOnWatch: false, // deprecated, move to lintOnWatch
  lintOnWatch: false,
  tslint: false,
  ci: {
    interval: 60000,
    owner: 'appium',
    repo: 'appium-build-store',
  },
};

As you can see, it defaults to transpiling with Babel, running eslint running tests, and with the default task being gulp watch.

transpile plugin

Babel and TypeScript compilation, sourcemaps and file renaming functionality in one plugin. .es7.js and .es6.js files will be automatically renamed to .js files. The necessary sourcemaps, comments and imports are also automatically added.

usage

1/ Configure gulp as below:

let gulp = require('gulp'),
Transpiler = require('appium-gulp-plugins').Transpiler;

gulp.task('transpile', function () {
  let transpiler = new Transpiler();
  // babel options are configurable in transpiler.babelOpts

  return gulp.src('test/fixtures/es7/**/*.js')
    .pipe(transpiler.stream())
    .pipe(gulp.dest('build'));
});

2/ in your code you need to mark the main and mocha files as below:

  • main: add // transpile:main at the beginning of the file (example here) .
  • mocha: add // transpile:mocha at the beginning of the file (example here)

Regular lib files do not need any extra comments.

watch plugin

There are some issues with Gulp 3.x error handling which cause the default gulp-watch to hang. This plugin is a small hack which solves that by respawning the whole process on error. This should not be needed in gulp 4.0.

Files in the /test directory that are named .*-specs.js are run. Tests which end in .*-e2e-specs.js are not run when watching. To run end-to-end tests, run gulp e2e-test.

usage

const gulp = require('gulp');
const spawnWatcher = require('./index').spawnWatcher.use(gulp, opts);

spawnWatcher.configure('watch', ['lib/**/*.js','test/**/*.js','!test/fixtures'], function () {
  // this is the watch action
  return runSequence('test');
});

The test function in spawnWatcher.configure should return a promise.

error handling

The spawn needs to catch error as soon as they happen. To do so use the spawnWatcher.handleError method, for instance:

// add error handling where needed
gulp.task('transpile', function () {
  return gulp.src('test/es7/**/*.js')
    .pipe(transpile())
    .on('error', spawnWatcher.handleError)
    .pipe(gulp.dest('build'));
});

gulp.task('test', ['transpile'] , function () {
  return gulp.src('build/test/a-specs.js')
    .pipe(mocha())
    .on('error', spawnWatcher.handleError);
});

notification

Native notification is enabled by default. To disable it use the --no-notif option.

collate logging and tests

Set the environment variable _FORCE_LOGS

iOS app building

This package can create gulp tasks for building and cleaning iOS apps. By providing an iosApps property in the options sent to boilerplate() with the following:

iosApps: {
  relativeLocations: {
    iphoneos: 'relative/path/to/device/app.app',
    iphonesimulator: 'relative/path/to/sim/app.app',
  },
  appName: 'AppName.app',
},

This will create a number of gulp tasks, centrally one named ios-apps:install, which will go through the process of cleaning the build, building, and putting the products into deterministic places.

The simulator app will be build in build/Release-iphonesimulator/<appName>, and the real device app will be in build/Release-iphoneos/<appName>.

To build for real devices, set the environment variable IOS_REAL_DEVICE or REAL_DEVICE. To specify an xcconfig file, set its location in the XCCONFIG_FILE environment variable.

hacking this package

Since this package is used to build and test all the Appium packages, it should not use any of those packages.

watch

npm run watch

test

npm test

Current Tags

  • 1.3.6-beta                                ...           beta (4 years ago)
  • 4.2.0                                ...           latest (3 months ago)

128 Versions

  • 4.2.0                                ...           3 months ago
  • 4.1.1                                ...           3 months ago
  • 4.1.0                                ...           6 months ago
  • 4.0.0                                ...           6 months ago
  • 3.8.6                                ...           7 months ago
  • 3.8.5                                ...           7 months ago
  • 3.8.4                                ...           8 months ago
  • 3.8.3                                ...           8 months ago
  • 3.8.2                                ...           8 months ago
  • 3.8.1                                ...           8 months ago
  • 3.8.0                                ...           8 months ago
  • 3.7.3                                ...           9 months ago
  • 3.7.2                                ...           9 months ago
  • 3.7.1                                ...           9 months ago
  • 3.7.0                                ...           9 months ago
  • 3.6.2                                ...           9 months ago
  • 3.6.1                                ...           10 months ago
  • 3.6.0                                ...           10 months ago
  • 3.5.0                                ...           10 months ago
  • 3.4.0                                ...           10 months ago
  • 3.3.0                                ...           10 months ago
  • 3.2.3                                ...           a year ago
  • 3.2.2                                ...           a year ago
  • 3.2.1                                ...           a year ago
  • 3.1.5                                ...           a year ago
  • 3.1.4                                ...           a year ago
  • 3.1.3                                ...           a year ago
  • 3.1.2                                ...           a year ago
  • 3.1.0                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 2.4.1                                ...           a year ago
  • 2.4.0                                ...           a year ago
  • 2.3.2                                ...           2 years ago
  • 2.3.1                                ...           2 years ago
  • 2.3.0                                ...           2 years ago
  • 2.2.2                                ...           2 years ago
  • 2.2.1                                ...           2 years ago
  • 2.2.0                                ...           2 years ago
  • 2.1.8                                ...           2 years ago
  • 2.1.7                                ...           2 years ago
  • 2.1.6                                ...           2 years ago
  • 2.1.5                                ...           2 years ago
  • 2.1.4                                ...           2 years ago
  • 2.1.3                                ...           2 years ago
  • 2.1.2                                ...           2 years ago
  • 2.1.1                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.5.0                                ...           2 years ago
  • 1.4.13                                ...           3 years ago
  • 1.4.12                                ...           3 years ago
  • 1.4.11                                ...           3 years ago
  • 1.4.10                                ...           3 years ago
  • 1.4.9                                ...           3 years ago
  • 1.4.8                                ...           3 years ago
  • 1.4.7                                ...           3 years ago
  • 1.4.6                                ...           3 years ago
  • 1.4.5                                ...           4 years ago
  • 1.4.4                                ...           4 years ago
  • 1.4.3                                ...           4 years ago
  • 1.4.2                                ...           4 years ago
  • 1.4.1                                ...           4 years ago
  • 1.4.0                                ...           4 years ago
  • 1.3.12                                ...           4 years ago
  • 1.3.11                                ...           4 years ago
  • 1.3.10                                ...           4 years ago
  • 1.3.9                                ...           4 years ago
  • 1.3.8                                ...           4 years ago
  • 1.3.7                                ...           4 years ago
  • 1.3.6                                ...           4 years ago
  • 1.3.6-beta                                ...           4 years ago
  • 1.3.5                                ...           4 years ago
  • 1.3.4                                ...           4 years ago
  • 1.3.3                                ...           4 years ago
  • 1.3.3-beta1                                ...           4 years ago
  • 1.3.2                                ...           4 years ago
  • 1.3.1                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.28                                ...           4 years ago
  • 1.2.27                                ...           4 years ago
  • 1.2.26                                ...           4 years ago
  • 1.2.25                                ...           4 years ago
  • 1.2.24                                ...           4 years ago
  • 1.2.23                                ...           4 years ago
  • 1.2.22                                ...           4 years ago
  • 1.2.21                                ...           4 years ago
  • 1.2.20                                ...           4 years ago
  • 1.2.19                                ...           4 years ago
  • 1.2.18                                ...           4 years ago
  • 1.2.17                                ...           4 years ago
  • 1.2.16                                ...           4 years ago
  • 1.2.15                                ...           4 years ago
  • 1.2.14                                ...           4 years ago
  • 1.2.13                                ...           4 years ago
  • 1.2.12                                ...           4 years ago
  • 1.2.11                                ...           4 years ago
  • 1.2.10                                ...           4 years ago
  • 1.2.9                                ...           4 years ago
  • 1.2.8                                ...           4 years ago
  • 1.2.7                                ...           4 years ago
  • 1.2.6                                ...           4 years ago
  • 1.2.5                                ...           4 years ago
  • 1.2.4                                ...           4 years ago
  • 1.2.3                                ...           4 years ago
  • 1.2.2                                ...           4 years ago
  • 1.2.1                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.8                                ...           4 years ago
  • 1.1.7                                ...           4 years ago
  • 1.1.6                                ...           4 years ago
  • 1.1.5                                ...           4 years ago
  • 1.1.4                                ...           4 years ago
  • 1.1.3                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 0.0.10                                ...           5 years ago
  • 0.0.9                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.7                                ...           5 years ago
  • 0.0.6                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
Downloads
Today 2
This Week 264
This Month 925
Last Day 181
Last Week 555
Last Month 1,286
Dependencies (57)
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |