Browse Source

make browser tests work by including testdata

...testdata was not being loaded correctly by the new browserify.js file, and
thus not all the tests were working. I have fixed this by including "testdata"
as one of the modules that is compiled by the browserify.js script.
patch-2
Ryan X. Charles 11 years ago
parent
commit
0adbc55e82
  1. 16
      Gruntfile.js
  2. 2
      README.md
  3. 3
      browserify.js
  4. 1
      test/index.html

16
Gruntfile.js

@ -18,23 +18,9 @@ module.exports = function(grunt) {
command: 'node ./browserify.js > browser/bundle.js',
},
browserifyData: {
options: {
stdout: true
},
command: 'browserify -t brfs test/testdata.js > browser/testdata.js'
command: 'browserify -t brfs -s testdata test/testdata.js -o browser/testdata.js'
},
},
browserify: {
test_data: {
src: ['test/testdata.js'],
dest: 'browser/testdata.js',
options: {
transform: ['brfs'],
debug: true,
standalone: 'testdata',
}
}
},
watch: {
readme: {
files: ['README.md'],

2
README.md

@ -267,7 +267,7 @@ Bitcore needs some developer love. Please send pull requests for bug fixes, code
Work to enable Bitcore for use in the browser is ongoing. To build bitcore for the browser:
```
npm install -g grunt-cli
grunt browserify
grunt shell
```
You can check a usage example at examples/example.html

3
browserify.js

@ -66,12 +66,15 @@ b.require('./util/util');
b.require('./util/EncodedData');
b.require('./util/VersionedData');
b.add('./browser/bignum_config.js');
b.require('./test/testdata.js', {expose: './testdata'});
b.transform('brfs');
modules.forEach(function(m) {
b.require('./' + m + '.js' ,{expose:m} );
});
var bopts = {
transform: ['brfs']
// detectGlobals: true,
// insertGlobals: 'Buffer',
// insertGlobalVars: {

1
test/index.html

@ -12,7 +12,6 @@
<script src="../node_modules/chai/chai.js"></script>
<script>mocha.setup('bdd')</script>
<script src="../browser/bundle.js"></script>
<script src="../browser/testdata.js"></script>
<script>
var bitcore = require('bitcore');

Loading…
Cancel
Save