mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 00:25:48 +00:00
fixes for minified version test minified version in SauceLabs
This commit is contained in:
33
Gulpfile.js
33
Gulpfile.js
@@ -13,6 +13,17 @@ var fs = require('fs');
|
|||||||
|
|
||||||
var pkg = require('./package.json');
|
var pkg = require('./package.json');
|
||||||
|
|
||||||
|
var uglifyOptions = {
|
||||||
|
mangle: {
|
||||||
|
except: ['_', 'RippleError', 'RippledError', 'UnexpectedError',
|
||||||
|
'LedgerVersionError', 'ConnectionError', 'NotConnectedError',
|
||||||
|
'DisconnectedError', 'TimeoutError', 'ResponseFormatError',
|
||||||
|
'ValidationError', 'NotFoundError', 'MissingLedgerHistoryError',
|
||||||
|
'PendingLedgerVersionError'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function webpackConfig(extension, overrides) {
|
function webpackConfig(extension, overrides) {
|
||||||
overrides = overrides || {};
|
overrides = overrides || {};
|
||||||
var defaults = {
|
var defaults = {
|
||||||
@@ -85,13 +96,17 @@ gulp.task('build-tests', function(callback) {
|
|||||||
'integration/'), done);
|
'integration/'), done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function createLink(from, to) {
|
||||||
|
if (fs.existsSync(to)) {
|
||||||
|
fs.unlinkSync(to);
|
||||||
|
}
|
||||||
|
fs.linkSync(from, to);
|
||||||
|
}
|
||||||
|
|
||||||
function createBuildLink(callback) {
|
function createBuildLink(callback) {
|
||||||
return function(err, res) {
|
return function(err, res) {
|
||||||
var latestBuildName = './build/ripple-latest.js';
|
createLink('./build/ripple-' + pkg.version + '.js',
|
||||||
if (fs.existsSync(latestBuildName)) {
|
'./build/ripple-latest.js');
|
||||||
fs.unlinkSync(latestBuildName);
|
|
||||||
}
|
|
||||||
fs.linkSync('./build/ripple-' + pkg.version + '.js', latestBuildName);
|
|
||||||
callback(err, res);
|
callback(err, res);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -102,9 +117,13 @@ gulp.task('build', function(callback) {
|
|||||||
|
|
||||||
gulp.task('build-min', ['build'], function() {
|
gulp.task('build-min', ['build'], function() {
|
||||||
return gulp.src(['./build/ripple-', '.js'].join(pkg.version))
|
return gulp.src(['./build/ripple-', '.js'].join(pkg.version))
|
||||||
.pipe(uglify())
|
.pipe(uglify(uglifyOptions))
|
||||||
.pipe(rename(['ripple-', '-min.js'].join(pkg.version)))
|
.pipe(rename(['ripple-', '-min.js'].join(pkg.version)))
|
||||||
.pipe(gulp.dest('./build/'));
|
.pipe(gulp.dest('./build/'))
|
||||||
|
.on('end', function() {
|
||||||
|
createLink('./build/ripple-' + pkg.version + '-min.js',
|
||||||
|
'./build/ripple-latest-min.js');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build-debug', function(callback) {
|
gulp.task('build-debug', function(callback) {
|
||||||
|
|||||||
4
npm-shrinkwrap.json
generated
4
npm-shrinkwrap.json
generated
@@ -155,8 +155,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ripple-binary-codec": {
|
"ripple-binary-codec": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-0.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-0.1.2.tgz",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-runtime": {
|
"babel-runtime": {
|
||||||
"version": "5.8.34",
|
"version": "5.8.34",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"jayson": "^1.2.2",
|
"jayson": "^1.2.2",
|
||||||
"lodash": "^3.1.0",
|
"lodash": "^3.1.0",
|
||||||
"ripple-address-codec": "^2.0.1",
|
"ripple-address-codec": "^2.0.1",
|
||||||
"ripple-binary-codec": "^0.1.1",
|
"ripple-binary-codec": "^0.1.2",
|
||||||
"ripple-hashes": "^0.1.0",
|
"ripple-hashes": "^0.1.0",
|
||||||
"ripple-keypairs": "^0.10.0",
|
"ripple-keypairs": "^0.10.0",
|
||||||
"ripple-lib-transactionparser": "^0.6.0",
|
"ripple-lib-transactionparser": "^0.6.0",
|
||||||
|
|||||||
@@ -36,11 +36,13 @@ unittest() {
|
|||||||
mocha --opts test-compiled/mocha.opts test-compiled
|
mocha --opts test-compiled/mocha.opts test-compiled
|
||||||
|
|
||||||
# compile tests for browser testing
|
# compile tests for browser testing
|
||||||
gulp build build-tests
|
gulp build-min build-tests
|
||||||
node --harmony test-compiled/mocked-server.js > /dev/null &
|
node --harmony test-compiled/mocked-server.js > /dev/null &
|
||||||
|
|
||||||
echo "Running tests in PhantomJS"
|
echo "Running tests in PhantomJS"
|
||||||
mocha-phantomjs test/localrunner.html
|
mocha-phantomjs test/localrunner.html
|
||||||
|
echo "Running tests using minified version in PhantomJS"
|
||||||
|
mocha-phantomjs test/localrunnermin.html
|
||||||
|
|
||||||
echo "Running tests in SauceLabs"
|
echo "Running tests in SauceLabs"
|
||||||
http-server &
|
http-server &
|
||||||
@@ -56,7 +58,7 @@ integrationtest() {
|
|||||||
mocha test/integration/http-integration-test.js
|
mocha test/integration/http-integration-test.js
|
||||||
|
|
||||||
# run integration tests in PhantomJS
|
# run integration tests in PhantomJS
|
||||||
gulp build-tests build
|
gulp build-tests build-min
|
||||||
echo "Running integragtion tests in PhantomJS"
|
echo "Running integragtion tests in PhantomJS"
|
||||||
mocha-phantomjs test/localintegrationrunner.html
|
mocha-phantomjs test/localintegrationrunner.html
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ function setPrototypeOf(object, prototype) {
|
|||||||
function getConstructorName(object) {
|
function getConstructorName(object) {
|
||||||
// hack for internet explorer
|
// hack for internet explorer
|
||||||
return process.browser ?
|
return process.browser ?
|
||||||
object.constructor.toString().match(/^function\s(.+)\(/)[1] :
|
object.constructor.toString().match(/^function\s+([^(]*)/)[1] :
|
||||||
object.constructor.name;
|
object.constructor.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
37
test/hacks/phantomhacks.js
Normal file
37
test/hacks/phantomhacks.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
'use strict';
|
||||||
|
// this one will be directly run in browser, so disable eslint
|
||||||
|
/* eslint-disable no-var, no-extend-native, consistent-this, func-style */
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var phantomTest = /PhantomJS/;
|
||||||
|
if (phantomTest.test(navigator.userAgent)) {
|
||||||
|
// mocha-phantomjs-core has wrong shim for Function.bind, so we
|
||||||
|
// will replace it with correct one
|
||||||
|
// this bind polyfill copied from MDN documentation
|
||||||
|
Function.prototype.bind = function(oThis) {
|
||||||
|
if (typeof this !== 'function') {
|
||||||
|
// closest thing possible to the ECMAScript 5
|
||||||
|
// internal IsCallable function
|
||||||
|
throw new TypeError(
|
||||||
|
'Function.prototype.bind - what is trying to be bound is not callable'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
var aArgs = Array.prototype.slice.call(arguments, 1);
|
||||||
|
var fToBind = this;
|
||||||
|
var FNOP = function() {};
|
||||||
|
var fBound = function() {
|
||||||
|
return fToBind.apply(this instanceof FNOP ? this : oThis,
|
||||||
|
aArgs.concat(Array.prototype.slice.call(arguments)));
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.prototype) {
|
||||||
|
// native functions don't have a prototype
|
||||||
|
FNOP.prototype = this.prototype;
|
||||||
|
}
|
||||||
|
fBound.prototype = new FNOP();
|
||||||
|
|
||||||
|
return fBound;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -9,41 +9,7 @@
|
|||||||
<div id="deb"></div>
|
<div id="deb"></div>
|
||||||
<div id="mocha"></div>
|
<div id="mocha"></div>
|
||||||
<script src="../node_modules/mocha/mocha.js"></script>
|
<script src="../node_modules/mocha/mocha.js"></script>
|
||||||
<script>
|
<script src="hacks/phantomhacks.js"></script>
|
||||||
(function() {
|
|
||||||
var phantomTest = /PhantomJS/;
|
|
||||||
if (phantomTest.test(navigator.userAgent)) {
|
|
||||||
// mocha-phantomjs-core has wrong shim for Function.bind, so we
|
|
||||||
// will replace it with correct one
|
|
||||||
// this bind polyfill copied from MDN documentation
|
|
||||||
Function.prototype.bind = function(oThis) {
|
|
||||||
if (typeof this !== 'function') {
|
|
||||||
// closest thing possible to the ECMAScript 5
|
|
||||||
// internal IsCallable function
|
|
||||||
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
|
|
||||||
}
|
|
||||||
|
|
||||||
var aArgs = Array.prototype.slice.call(arguments, 1),
|
|
||||||
fToBind = this,
|
|
||||||
fNOP = function() {},
|
|
||||||
fBound = function() {
|
|
||||||
return fToBind.apply(this instanceof fNOP
|
|
||||||
? this
|
|
||||||
: oThis,
|
|
||||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.prototype) {
|
|
||||||
// native functions don't have a prototype
|
|
||||||
fNOP.prototype = this.prototype;
|
|
||||||
}
|
|
||||||
fBound.prototype = new fNOP();
|
|
||||||
|
|
||||||
return fBound;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
<script src="../build/ripple-latest.js"></script>
|
<script src="../build/ripple-latest.js"></script>
|
||||||
<script>
|
<script>
|
||||||
if (window.initMochaPhantomJS) {
|
if (window.initMochaPhantomJS) {
|
||||||
|
|||||||
@@ -9,41 +9,7 @@
|
|||||||
<div id="deb"></div>
|
<div id="deb"></div>
|
||||||
<div id="mocha"></div>
|
<div id="mocha"></div>
|
||||||
<script src="../node_modules/mocha/mocha.js"></script>
|
<script src="../node_modules/mocha/mocha.js"></script>
|
||||||
<script>
|
<script src="hacks/phantomhacks.js"></script>
|
||||||
(function() {
|
|
||||||
var phantomTest = /PhantomJS/;
|
|
||||||
if (phantomTest.test(navigator.userAgent)) {
|
|
||||||
// mocha-phantomjs-core has wrong shim for Function.bind, so we
|
|
||||||
// will replace it with correct one
|
|
||||||
// this bind polyfill copied from MDN documentation
|
|
||||||
Function.prototype.bind = function(oThis) {
|
|
||||||
if (typeof this !== 'function') {
|
|
||||||
// closest thing possible to the ECMAScript 5
|
|
||||||
// internal IsCallable function
|
|
||||||
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
|
|
||||||
}
|
|
||||||
|
|
||||||
var aArgs = Array.prototype.slice.call(arguments, 1),
|
|
||||||
fToBind = this,
|
|
||||||
fNOP = function() {},
|
|
||||||
fBound = function() {
|
|
||||||
return fToBind.apply(this instanceof fNOP
|
|
||||||
? this
|
|
||||||
: oThis,
|
|
||||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
|
||||||
};
|
|
||||||
|
|
||||||
if (this.prototype) {
|
|
||||||
// native functions don't have a prototype
|
|
||||||
fNOP.prototype = this.prototype;
|
|
||||||
}
|
|
||||||
fBound.prototype = new fNOP();
|
|
||||||
|
|
||||||
return fBound;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
<script src="../build/ripple-latest.js"></script>
|
<script src="../build/ripple-latest.js"></script>
|
||||||
<script>
|
<script>
|
||||||
if (window.initMochaPhantomJS) {
|
if (window.initMochaPhantomJS) {
|
||||||
|
|||||||
33
test/localrunnermin.html
Normal file
33
test/localrunnermin.html
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<!-- encoding must be set for mocha's special characters to render properly -->
|
||||||
|
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
||||||
|
<script src="./vendor/lodash.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="deb"></div>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
<script src="../node_modules/mocha/mocha.js"></script>
|
||||||
|
<script src="hacks/phantomhacks.js"></script>
|
||||||
|
<script src="../build/ripple-latest-min.js"></script>
|
||||||
|
<script>
|
||||||
|
if (window.initMochaPhantomJS) {
|
||||||
|
window.initMochaPhantomJS();
|
||||||
|
}
|
||||||
|
mocha.ui('bdd')
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="../test-compiled-for-web/api-test.js"></script>
|
||||||
|
|
||||||
|
<script src="../test-compiled-for-web/broadcast-api-test.js"></script>
|
||||||
|
|
||||||
|
<script src="../test-compiled-for-web/connection-test.js"></script>
|
||||||
|
|
||||||
|
<script src="../test-compiled-for-web/rangeset-test.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
mocha.run()
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -10,9 +10,9 @@
|
|||||||
<div id="mocha"></div>
|
<div id="mocha"></div>
|
||||||
<script src="/node_modules/mocha/mocha.js"></script>
|
<script src="/node_modules/mocha/mocha.js"></script>
|
||||||
|
|
||||||
<script src="/node_modules/mocha-sauce/client.js"></script>
|
<script src="/node_modules/mocha-in-sauce/client.js"></script>
|
||||||
|
|
||||||
<script src="/build/ripple-latest.js"></script>
|
<script src="/build/ripple-latest-min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
mocha.ui('bdd')
|
mocha.ui('bdd')
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user