Permalink
Browse files

* added basic vendors to be used in child environments

* fixed eslint
* AbstractEnvironment was rewrote

:goose:
  • Loading branch information...
maZahaca committed Oct 3, 2017
1 parent 82e57af commit 4862784cca3d0330f18ec0cac22212f4217b2f1c
Showing with 266 additions and 26 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 build.js
  3. +19 −21 lib/AbstractEnvironment.js
  4. +5 −5 package.json
  5. +229 −0 vendor/sizzle.min.js
  6. +11 −0 vendor/xhr.sniffer.js
View
@@ -1,2 +1,3 @@
node_modules
build
.idea
View
@@ -14,3 +14,4 @@ delete pkg['lint-staged'];
fs.writeFileSync('build/package.json', JSON.stringify(pkg, null, ' '), 'utf-8');
fs.writeFileSync('build/LICENSE', fs.readFileSync('LICENSE', 'utf-8'), 'utf-8');
fs.writeFileSync('build/README.md', fs.readFileSync('README.md', 'utf-8'), 'utf-8');
cp.spawnSync('cp', ['-R', 'vendor', 'build/vendor']);
View
@@ -1,21 +1,19 @@
const vow = require('vow');
const debug = require('debug')('AbstractEnvironment');
/* eslint-disable no-unused-vars */
/* eslint-disable no-unused-vars,class-methods-use-this */
function AbstractEnvironment(options) {
debug('Initializing...');
class AbstractEnvironment {
constructor(options) {
debug('Initializing...');
this._errbacks = [];
this._options = options;
}
AbstractEnvironment.prototype = {
constructor: AbstractEnvironment,
this._errbacks = [];
this._options = options;
}
getOptions() {
return this._options;
},
}
/**
* Prepare environment
@@ -24,7 +22,7 @@ AbstractEnvironment.prototype = {
prepare() {
debug('Preparing...');
return vow.resolve();
},
}
/**
* Tear down environment
@@ -33,23 +31,23 @@ AbstractEnvironment.prototype = {
tearDown() {
debug('Tear down...');
return vow.resolve();
},
}
/**
* EvaluateJs in the environment
* @returns {Promise}
*/
evaluateJs() {
throw new Error('You must redefine evaluateJs method in child environment');
},
}
/**
* Take a snapshot
* @returns {Promise}
*/
snapshot() {
throw new Error('Current environment does not support snapshots');
},
}
/**
* Wait for page load
@@ -58,27 +56,27 @@ AbstractEnvironment.prototype = {
*/
waitForPage(timeout) {
throw new Error('You must redefine waitForPage method in child environment');
},
}
back() {
throw new Error('You must redefine back method in child environment');
},
}
mousedown() {
throw new Error('You must redefine back method in child environment');
},
}
mouseup() {
throw new Error('You must redefine back method in child environment');
},
}
addErrback(errback) {
this._errbacks.push(errback);
},
}
removeErrback(errback) {
this._errbacks = this._errbacks.filter(e => e !== errback);
},
};
}
}
module.exports = AbstractEnvironment;
View
@@ -1,9 +1,9 @@
{
"private": true,
"version": "1.0.3",
"version": "1.0.6",
"name": "goose-abstract-environment",
"main": "lib/AbstractEnvironment.js",
"repository": "redcode/goose-abstract-environment",
"repository": "redco/goose-abstract-environment",
"description": "Abstact Environment for Goose which can be base for other environments",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
@@ -29,14 +29,14 @@
},
"pre-commit": "lint:staged",
"lint-staged": {
"*.js": [
"lib/*.js": [
"eslint --fix",
"git add"
]
},
"scripts": {
"lint": "eslint --ignore-path .gitignore .",
"lint:fix": "eslint --ignore-path .gitignore --fix .",
"lint": "eslint --ignore-path .gitignore ./lib",
"lint:fix": "eslint --ignore-path .gitignore --fix ./lib",
"lint:staged": "lint-staged",
"build": "node build.js",
"prepublish": "node build"
Oops, something went wrong.

0 comments on commit 4862784

Please sign in to comment.