From efd8a8a62477398b1e99f5a104dc2303895124f9 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 20 May 2015 13:37:46 +0800 Subject: [PATCH] spec: original-fs is available in forked scripts --- spec/asar-spec.coffee | 14 +++++++++++--- spec/fixtures/module/original-fs.js | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 spec/fixtures/module/original-fs.js diff --git a/spec/asar-spec.coffee b/spec/asar-spec.coffee index d78ab436061..3ad706b69e5 100644 --- a/spec/asar-spec.coffee +++ b/spec/asar-spec.coffee @@ -1,6 +1,7 @@ -assert = require 'assert' -fs = require 'fs' -path = require 'path' +assert = require 'assert' +child_process = require 'child_process' +fs = require 'fs' +path = require 'path' describe 'asar package', -> fixtures = path.join __dirname, 'fixtures' @@ -443,6 +444,13 @@ describe 'asar package', -> stats = originalFs.statSync file assert stats.isFile() + it 'is available in forked scripts', (done) -> + child = child_process.fork path.join(fixtures, 'module', 'original-fs.js') + child.on 'message', (msg) -> + assert.equal msg, 'object' + done() + child.send 'message' + describe 'graceful-fs module', -> gfs = require 'graceful-fs' diff --git a/spec/fixtures/module/original-fs.js b/spec/fixtures/module/original-fs.js new file mode 100644 index 00000000000..90b6abcf9b7 --- /dev/null +++ b/spec/fixtures/module/original-fs.js @@ -0,0 +1,3 @@ +process.on('message', function (msg) { + process.send(typeof require('original-fs')); +});