Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
appium-gulp-plugins
Advanced tools
Readme
Custom plugins used accross appium modules
This plugin sets up all the other typical plugins we use with a simple configuration object.
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
):
let DEFAULT_OPTS = {
files: ["*.js", "lib/**/*.js", "test/**/*.js", "!gulpfile.js"],
transpile: true,
transpileOut: "build",
babelOpts: {},
linkBabelRuntime: true,
watch: true,
test: true,
testFiles: null,
testReporter: 'nyan',
testTimeout: 8000,
buildName: null,
extraPrepublishTasks: [],
eslint: true
};
As you can see, it defaults to transpiling with Babel, running eslint
running tests, and with the default task being gulp watch
.
Babel 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.
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:
// transpile:main
at the beginning of the file (example here) .// transpile:mocha
at the beginning of the file (example here)Regular lib files do not need any extra comments.
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
.
let gulp = require('gulp'),
spawnWatcher = require('./index').spawnWatcher.use(gulp);
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.
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);
});
Terminal is cleared by default. To avoid that call:
spawnWatcher.clear(false);
Native notification is enabled by default. To disable it use the
--no-notif
option.
Set the environment variable _FORCE_LOGS
npm run watch
npm test
FAQs
Custom gulp plugins to be used across all appium modules
We found that appium-gulp-plugins demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.