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

Commit 243ce93

Browse files
Jack HortonJack Horton
authored andcommitted
test: fixing test breaks for chakracore
* test-console: added specific message * test-windows-failed-heap-allocation: skipped due to V8 option max-old-space-size * n-api: added implementation for new number APIs * test-require-json: added specific message * test-util-internal: added common require * test-inspector: added specific message n-api,test: fixing test failures
1 parent e813471 commit 243ce93

File tree

6 files changed

+49
-8
lines changed

6 files changed

+49
-8
lines changed

src/node_api_jsrt.cc

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,14 +1122,40 @@ napi_status napi_create_string_utf16(napi_env env,
11221122
return napi_ok;
11231123
}
11241124

1125-
napi_status napi_create_number(napi_env env,
1125+
napi_status napi_create_double(napi_env env,
11261126
double value,
11271127
napi_value* result) {
11281128
CHECK_ARG(result);
11291129
CHECK_JSRT(JsDoubleToNumber(value, reinterpret_cast<JsValueRef*>(result)));
11301130
return napi_ok;
11311131
}
11321132

1133+
napi_status napi_create_int32(napi_env env,
1134+
int32_t value,
1135+
napi_value* result) {
1136+
CHECK_ARG(result);
1137+
CHECK_JSRT(JsIntToNumber(value, reinterpret_cast<JsValueRef*>(result)));
1138+
return napi_ok;
1139+
}
1140+
1141+
napi_status napi_create_uint32(napi_env env,
1142+
uint32_t value,
1143+
napi_value* result) {
1144+
CHECK_ARG(result);
1145+
CHECK_JSRT(JsDoubleToNumber(static_cast<double>(value),
1146+
reinterpret_cast<JsValueRef*>(result)));
1147+
return napi_ok;
1148+
}
1149+
1150+
napi_status napi_create_int64(napi_env env,
1151+
int64_t value,
1152+
napi_value* result) {
1153+
CHECK_ARG(result);
1154+
CHECK_JSRT(JsDoubleToNumber(static_cast<double>(value),
1155+
reinterpret_cast<JsValueRef*>(result)));
1156+
return napi_ok;
1157+
}
1158+
11331159
napi_status napi_get_boolean(napi_env env, bool value, napi_value* result) {
11341160
CHECK_ARG(result);
11351161
CHECK_JSRT(JsBoolToBoolean(value, reinterpret_cast<JsValueRef*>(result)));

test/inspector/test-inspector.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,10 @@ function testCommandLineAPI(session) {
345345
checkException(message);
346346
assert.deepStrictEqual(JSON.parse(message['result']['value']), {
347347
parentsEqual: true,
348-
parentId: common.engineSpecificMessage({chakracore: '.', v8: '<inspector console>'})
348+
parentId: common.engineSpecificMessage({
349+
v8: '<inspector console>',
350+
chakracore: '.'
351+
})
349352
});
350353
}
351354
],

test/parallel/test-console.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,18 @@ assert.doesNotThrow(function() {
4242
console.timeEnd('label');
4343
});
4444

45-
assert.throws(() => console.time(Symbol('test')),
46-
/^TypeError: Cannot convert a Symbol value to a string$/);
47-
assert.throws(() => console.timeEnd(Symbol('test')),
48-
/^TypeError: Cannot convert a Symbol value to a string$/);
45+
assert.throws(
46+
() => console.time(Symbol('test')),
47+
common.engineSpecificMessage({
48+
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
49+
chakracore: /^TypeError: Object doesn't support property or method 'ToString'$/
50+
}));
51+
assert.throws(
52+
() => console.timeEnd(Symbol('test')),
53+
common.engineSpecificMessage({
54+
v8: /^TypeError: Cannot convert a Symbol value to a string$/,
55+
chakracore: /^TypeError: Object doesn't support property or method 'ToString'$/
56+
}));
4957

5058

5159
// an Object with a custom .inspect() function

test/parallel/test-require-json.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
require('../common');
23+
const common = require('../common');
2424
const assert = require('assert');
2525
const fixtures = require('../common/fixtures');
2626

test/parallel/test-util-internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
// Flags: --expose_internals
33

4-
require('../common');
4+
const common = require('../common');
55
const assert = require('assert');
66
const fixtures = require('../common/fixtures');
77

test/parallel/test-windows-failed-heap-allocation.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ const common = require('../common');
55

66
if (!common.isWindows) return common.skip('Windows-only');
77

8+
if (common.isChakraEngine)
9+
common.skip('This test is disabled for chakra engine because it depends ' +
10+
'on v8-option --max-old-space-size');
11+
812
const assert = require('assert');
913
const { exec } = require('child_process');
1014

0 commit comments

Comments
 (0)