From 735da3d97f55d2d5bf6bce16218c7cde36a81a0b Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 15 Feb 2018 21:27:49 -0800 Subject: [PATCH] move common.js to node/ folder so it doesn't run in ES5 browsers --- bin/download-node-tests.js | 3 +++ test/{ => node}/common.js | 0 test/node/test-buffer-alloc.js | 2 +- test/node/test-buffer-arraybuffer.js | 2 +- test/node/test-buffer-fill.js | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) rename test/{ => node}/common.js (100%) diff --git a/bin/download-node-tests.js b/bin/download-node-tests.js index 464bb47..0be09cb 100755 --- a/bin/download-node-tests.js +++ b/bin/download-node-tests.js @@ -71,6 +71,9 @@ function testfixer (filename) { firstline = false } + // make `require('../common')` work + line = line.replace(/require\('\.\.\/common'\);/g, 'require(\'./common\')') + // require browser buffer line = line.replace(/(.*)require\('buffer'\)(.*)/g, '$1require(\'../../\')$2') diff --git a/test/common.js b/test/node/common.js similarity index 100% rename from test/common.js rename to test/node/common.js diff --git a/test/node/test-buffer-alloc.js b/test/node/test-buffer-alloc.js index aa6dc48..03cc26d 100644 --- a/test/node/test-buffer-alloc.js +++ b/test/node/test-buffer-alloc.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -const common = require('../common'); +const common = require('./common'); const assert = require('assert'); const vm = require('vm'); diff --git a/test/node/test-buffer-arraybuffer.js b/test/node/test-buffer-arraybuffer.js index 4e3b31a..d264e7f 100644 --- a/test/node/test-buffer-arraybuffer.js +++ b/test/node/test-buffer-arraybuffer.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -var common = require('../common'); +var common = require('./common'); var assert = require('assert'); diff --git a/test/node/test-buffer-fill.js b/test/node/test-buffer-fill.js index eb88b83..56d479c 100644 --- a/test/node/test-buffer-fill.js +++ b/test/node/test-buffer-fill.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -const common = require('../common'); +const common = require('./common'); var assert = require('assert'); -- 2.34.1