From 0adbc55e828bf1ffad8ed53c22914129d83cbf08 Mon Sep 17 00:00:00 2001 From: "Ryan X. Charles" Date: Sat, 8 Mar 2014 21:34:21 -0500 Subject: [PATCH] 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. --- Gruntfile.js | 16 +--------------- README.md | 2 +- browserify.js | 3 +++ test/index.html | 1 - 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index dc737c871..d43288543 100644 --- a/Gruntfile.js +++ b/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'], diff --git a/README.md b/README.md index 09cd6f2f6..2d0dee3ca 100644 --- a/README.md +++ b/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 diff --git a/browserify.js b/browserify.js index cbc8941f0..202eb87d2 100644 --- a/browserify.js +++ b/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: { diff --git a/test/index.html b/test/index.html index 9946f5c9c..798acd80f 100644 --- a/test/index.html +++ b/test/index.html @@ -12,7 +12,6 @@ -