tests work in browser and node
This commit is contained in:
parent
12d7274588
commit
5a90473d12
|
@ -31,10 +31,7 @@
|
|||
"after",
|
||||
"afterEach",
|
||||
"requirejs",
|
||||
"it",
|
||||
"chai",
|
||||
"bitcore"
|
||||
|
||||
"it"
|
||||
],
|
||||
"indent": false, // Specify indentation spacing
|
||||
"devel": true, // Allow development statements e.g. `console.log();`.
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports = function(grunt) {
|
|||
grunt.initConfig({
|
||||
browserify: {
|
||||
client: {
|
||||
src: ['main.js'],
|
||||
src: ['bitcore.js'],
|
||||
dest: 'browser/bundle.js',
|
||||
options: {
|
||||
alias: ['browserify-bignum/bignumber.js:bignum'],
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Bitcore bindings for the browser
|
||||
*/
|
||||
|
||||
|
||||
module.exports.bignum = require('bignum');
|
||||
module.exports.base58 = require('base58-native');
|
||||
//module.exports.Address = require('./Address');
|
||||
|
||||
|
||||
|
||||
if (typeof process.versions === 'undefined') {
|
||||
module.exports.bignum.config({EXPONENTIAL_AT: 9999999, DECIMAL_PLACES: 0, ROUNDING_MODE: 1});
|
||||
}
|
||||
|
9
main.js
9
main.js
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* Bitcore bindings for the browser
|
||||
*/
|
||||
|
||||
module.exports.bignum = require('bignum');
|
||||
module.exports.base58 = require('base58-native');
|
||||
|
||||
module.exports.bignum.config({EXPONENTIAL_AT: 9999999, DECIMAL_PLACES: 0, ROUNDING_MODE: 1});
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
'use strict';
|
||||
|
||||
if (typeof require === 'undefined') {
|
||||
var that = this;
|
||||
that.require = function(name) {
|
||||
var split = name.split('/');
|
||||
if (split.length > 0) {
|
||||
name = split.pop();
|
||||
}
|
||||
var module = that[name];
|
||||
if (!module) {
|
||||
throw new Error('Cannot find module "'+name+'"');
|
||||
}
|
||||
return module;
|
||||
};
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
<script src="adapter.js"></script>
|
||||
<script src="mocha.js"></script>
|
||||
<script src="../node_modules/chai/chai.js"></script>
|
||||
<script>mocha.setup('bdd')</script>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
var chai = require('chai');
|
||||
var bitcore = require('../bitcore');
|
||||
|
||||
var expect = chai.expect;
|
||||
var should = chai.should();
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var chai = require('chai');
|
||||
var bitcore = require('../bitcore');
|
||||
|
||||
var expect = chai.expect;
|
||||
var should = chai.should();
|
||||
|
|
Loading…
Reference in New Issue