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.
This commit is contained in:
Ryan X. Charles 2014-03-08 21:34:21 -05:00
parent c19fb7a3ce
commit 0adbc55e82
4 changed files with 5 additions and 17 deletions

View File

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

View File

@ -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: Work to enable Bitcore for use in the browser is ongoing. To build bitcore for the browser:
``` ```
npm install -g grunt-cli npm install -g grunt-cli
grunt browserify grunt shell
``` ```
You can check a usage example at examples/example.html You can check a usage example at examples/example.html

View File

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

View File

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