Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit 17b469b

Browse files
committed
test: prefer common.isChakraEngine
Replace usages of `process.jsEngine` in tests with `common.isChakraEngine` checks. PR-URL: #493 Reviewed-By: Jack Horton <Jack.Horton@microsoft.com>
1 parent b27fa80 commit 17b469b

File tree

9 files changed

+12
-12
lines changed

9 files changed

+12
-12
lines changed

test/addons-napi/test_buffer/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ assert.strictEqual(binding.newBuffer().toString(), binding.theText);
99
assert.strictEqual(binding.newExternalBuffer().toString(), binding.theText);
1010

1111
// Don't rely on Chakra's GC to behave the same as v8's.
12-
if (process.jsEngine !== 'chakracore') {
12+
if (!common.isChakraEngine) {
1313
console.log('gc1');
1414
global.gc();
1515
assert.strictEqual(binding.getDeleterCallCount(), 1);
@@ -23,7 +23,7 @@ assert.strictEqual(binding.bufferInfo(buffer), true);
2323
buffer = null;
2424

2525
// Don't rely on Chakra's GC to behave the same as v8's.
26-
if (process.jsEngine !== 'chakracore') {
26+
if (!common.isChakraEngine) {
2727
global.gc();
2828
console.log('gc2');
2929
assert.strictEqual(binding.getDeleterCallCount(), 2);

test/common/inspector-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class InspectorSession {
265265
if (!Array.isArray(values))
266266
values = [ values ];
267267

268-
if (process.jsEngine === 'chakracore') {
268+
if (common.isChakraEngine) {
269269
// Only the first parameter is returned by ChakraCore
270270
values = values.slice(0, 1);
271271
}

test/parallel/test-assert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ common.expectsError(
630630
// Test caching.
631631
const fs = process.binding('fs');
632632
const tmp = fs.close;
633-
fs.close = common.mustCall(tmp, process.jsEngine === 'chakracore' ? 0 : 1);
633+
fs.close = common.mustCall(tmp, common.isChakraEngine ? 0 : 1);
634634
function throwErr() {
635635
// eslint-disable-next-line prefer-assert-methods
636636
assert(

test/parallel/test-buffer-writedouble.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Tests to verify doubles are correctly written
44

5-
require('../common');
5+
const common = require('../common');
66
const assert = require('assert');
77

88
const buffer = Buffer.allocUnsafe(16);
@@ -67,7 +67,7 @@ assert.strictEqual(buffer.readDoubleLE(8), -Infinity);
6767
buffer.writeDoubleBE(NaN, 0);
6868
buffer.writeDoubleLE(NaN, 8);
6969

70-
if (process.jsEngine === 'chakracore') {
70+
if (common.isChakraEngine) {
7171
assert.ok(buffer.equals(new Uint8Array([
7272
0xFF, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7373
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF

test/parallel/test-buffer-writefloat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Tests to verify floats are correctly written
44

5-
require('../common');
5+
const common = require('../common');
66
const assert = require('assert');
77

88
const buffer = Buffer.allocUnsafe(8);
@@ -51,7 +51,7 @@ assert.strictEqual(buffer.readFloatLE(4), -Infinity);
5151
buffer.writeFloatBE(NaN, 0);
5252
buffer.writeFloatLE(NaN, 4);
5353
assert.ok(buffer.equals(
54-
process.jsEngine === 'chakracore' ?
54+
common.isChakraEngine ?
5555
new Uint8Array([ 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF ]) :
5656
new Uint8Array([ 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7F ])));
5757

test/parallel/test-cli-syntax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ syntaxArgs.forEach(function(args) {
116116
const c = spawnSync(node, args, { encoding: 'utf8', input: stdin });
117117

118118
// stderr should include '[stdin]' as the filename
119-
if (process.jsEngine === 'v8') {
119+
if (!common.isChakraEngine) {
120120
assert(c.stderr.startsWith('[stdin]'), `${c.stderr} starts with ${stdin}`);
121121
}
122122

test/sequential/test-inspector-debug-brk-flag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async function testBreakpointOnStart(session) {
1717
'params': { 'maxDepth': 0 } }
1818
];
1919

20-
if (process.jsEngine !== 'chakracore') {
20+
if (!common.isChakraEngine) {
2121
commands.push(
2222
{ 'method': 'Profiler.enable' },
2323
{ 'method': 'Profiler.setSamplingInterval',

test/sequential/test-inspector-exception.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async function testBreakpointOnStart(session) {
2222
'params': { 'maxDepth': 0 } }
2323
];
2424

25-
if (process.jsEngine !== 'chakracore') {
25+
if (!common.isChakraEngine) {
2626
commands.push(
2727
{ 'method': 'Profiler.enable' },
2828
{ 'method': 'Profiler.setSamplingInterval',

test/sequential/test-inspector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async function testBreakpointOnStart(session) {
7373
'params': { 'maxDepth': 0 } }
7474
];
7575

76-
if (process.jsEngine !== 'chakracore') {
76+
if (!common.isChakraEngine) {
7777
commands.push(
7878
{ 'method': 'Profiler.enable' },
7979
{ 'method': 'Profiler.setSamplingInterval',

0 commit comments

Comments
 (0)