Skip to content

Instantly share code, notes, and snippets.

@stomita
Last active August 29, 2015 14:16
Show Gist options
  • Save stomita/df4a4826eb9278e3d853 to your computer and use it in GitHub Desktop.
Save stomita/df4a4826eb9278e3d853 to your computer and use it in GitHub Desktop.
browserify+espowerifyでassertの結果がおかしくなる件
/*
* browserify -t espowerify ./build/test/e2e/app001.test.js > ./build/test/e2e/app001.test-bundle-by-cmd.js
*/
//...
'use strict';
var assert = require('power-assert');
describe('apptest001', function () {
it('should raise', function () {
assert(assert._expr(assert._capt(1 === 0, 'arguments/0'), {
content: 'assert(1 === 0)',
filepath: '/tmp/tmpproject/build/test/e2e/app001.test.js',
line: 7
}));
});
});
//...
'use strict';
var assert = require('power-assert');
describe('apptest001', function () {
it('should raise', function () {
assert(assert._expr(assert._capt(assert._capt(assert, 'arguments/0/callee/object')._expr(assert._capt(assert._capt(assert, 'arguments/0/arguments/0/callee/object')._capt(assert._capt(1 === 0, 'arguments/0/arguments/0/arguments/0'), 'arguments/0'), 'arguments/0/arguments/0'), {
content: 'assert(1 === 0)',
filepath: '/tmp/tmpproject/build/test/e2e/app001.test.js',
line: 7
}), 'arguments/0'), {
content: 'assert(assert._expr(assert._capt(1 === 0, \'arguments/0\'), {content: \'assert(1 === 0)\',filepath: \'/tmp/tmpproject/build/test/e2e/app001.test.js\',line: 7}))',
filepath: '/tmp/tmpproject/build/test/e2e/app001.test.js',
line: 7
}));
});
});
//...
"use strict";
var assert = require("power-assert");
describe("apptest001", function() {
it("should raise", function() {
assert(1 === 0);
});
});
gulp = require "gulp"
browserify = require "browserify"
espowerify = require "espowerify"
source = require "vinyl-source-stream"
# Bundle test scripts for browser testing
gulp.task "bundle", ->
browserify "./build/test/e2e/app001.test.js",
transform: [ espowerify ]
.bundle()
.pipe source("app001.test-bundle.js")
.pipe gulp.dest "./build/test/e2e"
@stomita
Copy link
Author

stomita commented Feb 24, 2015

app001.test.jsが元ファイル
app001.test-bundle-by-cmd.js は正しく出力されている
app001.test-bundle.js は gulpからbrowserify(+espowerify)を実行した結果
(共に関係ない部分は省略)

@stomita
Copy link
Author

stomita commented Feb 24, 2015

browserifyのバージョンを最新(9.0.3)にあげたらなおりました
この現象が出たバージョン:8.1.3

@stomita
Copy link
Author

stomita commented Feb 24, 2015

ちなみにコマンドラインで適用したbrowserifyのバージョンはglobalのだったのでもっと古かった(5.9.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment