Socket
Socket
Sign inDemoInstall

appium-gulp-plugins

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appium-gulp-plugins - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

test/fixtures/es7/lib/rtts-assert-error.es7.js

6

gulpfile.js

@@ -13,2 +13,4 @@ "use strict";

var argv = require('yargs').count('rttsAssert').argv;
gulp.task('jscs', function () {

@@ -37,3 +39,3 @@ return gulp

gulp.task('transpile-es7-fixtures', ['del-build'] , function () {
var transpiler = new Transpiler();
var transpiler = new Transpiler(argv.rttsAssert ? {'rtts-assert': true} : null);
return gulp.src('test/fixtures/es7/**/*.js')

@@ -70,3 +72,3 @@ .pipe(transpiler.stream())

spawnWatcher.clear(false);
spawnWatcher.configure('watch', ['lib/**/*.js','test/**/*.js','!test/fixtures'], function () {
spawnWatcher.configure('watch', ['index.js', 'lib/**/*.js','test/**/*.js','!test/fixtures'], function () {
return runSequence('lint', 'test');

@@ -73,0 +75,0 @@ });

"use strict";
var traceur = require('gulp-traceur'),

@@ -15,5 +14,10 @@ replace = require('gulp-replace'),

sourceMaps: 'inline',
types: true
};
var RTTS_ASSERT_OPTS = {
types: true,
typeAssertions: true,
typeAssertionModule: 'appium-transpile-runtime/assets/rtts-assert'
};
var HEADER =

@@ -29,7 +33,10 @@ '/*# sourceMappingURL=path/to/source.map*/\n' +

module.exports = function () {
module.exports = function (opts) {
opts =opts || {};
this.traceurOpts = _.clone(TRACEUR_OPTS);
if (opts['rtts-assert']) _.extend(this.traceurOpts, RTTS_ASSERT_OPTS);
this.header = HEADER;
this.stream = function () {
var stream = replace(/\/\/\s+transpile:(main|mocha)\s*/g, this.header);
if (opts['rtts-assert']) stream.pipe(replace(/\/\*(:\w+)\*\//g,'$1'));
stream.pipe(traceur(this.traceurOpts));

@@ -40,2 +47,1 @@ stream.pipe(renameEsX());

};

@@ -7,3 +7,3 @@ {

],
"version": "0.0.8",
"version": "0.0.9",
"author": "appium",

@@ -42,3 +42,3 @@ "license": "Apache License 2.0",

"devDependencies": {
"appium-transpile-runtime": "0.0.2",
"appium-transpile-runtime": "0.0.4",
"chai": "^1.10.0",

@@ -54,4 +54,5 @@ "del": "^1.1.0",

"run-sequence": "^1.0.2",
"vargs": "^0.1.0"
"vargs": "^0.1.0",
"yargs": "^1.3.3"
}
}

@@ -44,2 +44,21 @@ appium-gulp-plugins

### rtts-assert
Type assertions may be enable by passing the following
option to the traspiler:
```js
var transpiler = new Transpiler({'rtts-assert': true});
```
You may specify type in your code like in the following:
```js
// The regular way
let a = function(t:string, n:number):string {return 'let's type code.'};
// Within comments
let a = function(ti/*:string*/, n/*:number*/)/*:string*/ {return 'let's type code.'};
```
## watch plugin

@@ -100,1 +119,15 @@

`--no-notif` option.
## hacking this package
### watch
```
npm run watch
```
### test
```
npm test
```
class A {
constructor (text) {
constructor (text/*:string*/) {
this.text = text;
}
getText () {
getText ()/*:string*/ {
return this.text;

@@ -8,0 +8,0 @@ }

@@ -7,4 +7,3 @@ "use strict";

chai = require('chai'),
openFile = Q.denodeify(require('fs').open),
closeFile = Q.denodeify(require('fs').close);
readFile = Q.denodeify(require('fs').readFile);

@@ -39,12 +38,30 @@ chai.should();

}).then(function () {
return openFile('build/lib/a.js', 'r');
}).then(function (fd) {
return closeFile(fd);
return readFile('build/lib/a.js', 'utf8');
}).then(function (content) {
content.should.have.length.above(0);
content.should.not.include('rtts-assert');
content.should.include('sourceMapping');
});
});
describe('check transpiled code', function () {
it('should transpile es7 fixtures with rtts-assert enabled', function () {
return exec('./node_modules/.bin/gulp transpile-es7-fixtures --rttsAssert')
.spread(function (stdout, stderr) {
print(stdout, stderr);
stderr.should.equal('');
stdout.should.include('Finished');
}).then(function () {
return readFile('build/lib/a.js', 'utf8');
}).then(function (content) {
content.should.have.length.above(0);
content.should.include('rtts-assert');
content.should.include('sourceMapping');
});
});
before(function () {
return exec('./node_modules/.bin/gulp transpile-es7-fixtures');
var checkCode = function (opts) {
opts = opts || {};
var gulpOpts = opts['rtts-assert'] ? ' --rttsAssert' : '';
before(function () {
return exec('./node_modules/.bin/gulp transpile-es7-fixtures' + gulpOpts);
});

@@ -70,2 +87,24 @@

if (opts['rtts-assert']) {
it('should detect a rtts-assert error', function () {
return exec('node build/lib/rtts-assert-error.js')
.spread(function (stdout, stderr) {
print(stdout, stderr);
stderr.should.equal('');
stdout.should.not.include('hello world!');
stdout.should.include('Invalid arguments given!');
});
});
} else {
it('should not detect a rtts-assert error', function () {
return exec('node build/lib/rtts-assert-error.js')
.spread(function (stdout, stderr) {
print(stdout, stderr);
stderr.should.equal('');
stdout.should.include('123');
stdout.should.not.include('Invalid arguments given!');
});
});
}
it('should use sourcemap when throwing', function () {

@@ -94,3 +133,3 @@ return exec('node build/lib/throw.js')

it('should be able to use gulp-mocha', function () {
return exec('./node_modules/.bin/gulp test-es7-mocha')
return exec('./node_modules/.bin/gulp test-es7-mocha' + gulpOpts)
.spread(function (stdout, stderr) {

@@ -104,3 +143,3 @@ print(stdout, stderr);

it('should use sourcemap when throwing within gulp-mocha', function () {
return exec('./node_modules/.bin/gulp --no-notif test-es7-mocha-throw')
return exec('./node_modules/.bin/gulp --no-notif test-es7-mocha-throw' + gulpOpts)
.spread(function (stdout, stderr) {

@@ -114,3 +153,12 @@ print(stdout, stderr);

};
describe('check transpiled code', function () {
checkCode();
});
describe('check transpiled code when rtts-assert is enabled', function () {
checkCode({'rtts-assert': true});
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc