From 91a9798c6d55dd02f33ef04ebf85835d764af8b3 Mon Sep 17 00:00:00 2001 From: Kyle Farnung Date: Thu, 13 Apr 2017 14:40:55 -0700 Subject: [PATCH] test: enable inspector tests Enabled tests for inspector and updated them to account for differences between V8 and ChakraCore. PR-URL: https://github.com/nodejs/node-chakracore/pull/247 Reviewed-By: Hitesh Kanwathirtha Reviewed-By: Kunal Pathak --- test/inspector/inspector.status | 3 --- test/inspector/test-inspector.js | 36 ++++++++++++++++++++++++-------- vcbuild.bat | 4 ++-- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/test/inspector/inspector.status b/test/inspector/inspector.status index ba965362b44..ed6a782b903 100644 --- a/test/inspector/inspector.status +++ b/test/inspector/inspector.status @@ -7,6 +7,3 @@ prefix inspector [true] # This section applies to all platforms [$system==win32] - -[$jsEngine==chakracore] -* : PASS,FLAKY diff --git a/test/inspector/test-inspector.js b/test/inspector/test-inspector.js index 9d6bb563e11..f323459064d 100644 --- a/test/inspector/test-inspector.js +++ b/test/inspector/test-inspector.js @@ -27,9 +27,15 @@ function checkVersion(err, response) { } function checkBadPath(err, response) { - assert(err instanceof SyntaxError); - assert(/Unexpected token/.test(err.message)); - assert(/WebSockets request was expected/.test(err.response)); + assert(err instanceof SyntaxError, 'Expected SyntaxError'); + assert( + common.engineSpecificMessage({ + v8: /Unexpected token/, + chakracore: /JSON\.parse Error: Invalid character at position:1/}) + .test(err.message), + 'Unexpected message: ' + err.message); + assert(/WebSockets request was expected/.test(err.response), + 'Unexpected response: ' + err.response); } function expectMainScriptSource(result) { @@ -56,6 +62,12 @@ function setupExpectBreakOnLine(line, url, session, scopeIdCallback) { function setupExpectConsoleOutput(type, values) { if (!(values instanceof Array)) values = [ values ]; + + if (process.jsEngine === 'chakracore') { + // Only the first parameter is returned by ChakraCore + values = values.slice(0, 1); + } + return function(message) { if ('Runtime.consoleAPICalled' === message['method']) { const params = message['params']; @@ -103,14 +115,20 @@ function testBreakpointOnStart(session) { { 'method': 'Debugger.setPauseOnExceptions', 'params': {'state': 'none'} }, { 'method': 'Debugger.setAsyncCallStackDepth', - 'params': {'maxDepth': 0} }, - { 'method': 'Profiler.enable' }, - { 'method': 'Profiler.setSamplingInterval', - 'params': {'interval': 100} }, + 'params': {'maxDepth': 0} } + ]; + + if (process.jsEngine !== 'chakracore') { + commands.push( + { 'method': 'Profiler.enable' }, + { 'method': 'Profiler.setSamplingInterval', + 'params': {'interval': 100} }); + } + + commands.push( { 'method': 'Debugger.setBlackboxPatterns', 'params': {'patterns': []} }, - { 'method': 'Runtime.runIfWaitingForDebugger' } - ]; + { 'method': 'Runtime.runIfWaitingForDebugger' }); session .sendInspectorCommands(commands) diff --git a/vcbuild.bat b/vcbuild.bat index 91441ef51d0..cae154f9edd 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -67,8 +67,8 @@ if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok if /i "%1"=="noetw" set noetw=1&goto arg-ok if /i "%1"=="noperfctr" set noperfctr=1&goto arg-ok if /i "%1"=="licensertf" set licensertf=1&goto arg-ok -if /i "%1"=="test" set test_args=%test_args% doctool known_issues message parallel sequential addons addons-napi -J&set cpplint=1&set jslint=1&set build_addons=1&set build_addons_napi=1&goto arg-ok -if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap doctool inspector known_issues message sequential parallel addons addons-napi&set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap&set build_addons=1&set build_addons_napi=1&goto arg-ok +if /i "%1"=="test" set test_args=%test_args% doctool known_issues message parallel sequential addons addons-napi inspector -J&set cpplint=1&set jslint=1&set build_addons=1&set build_addons_napi=1&goto arg-ok +if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap doctool inspector known_issues message sequential parallel addons addons-napi inspector&set cctest_args=%cctest_args% --gtest_output=tap:cctest.tap&set build_addons=1&set build_addons_napi=1&goto arg-ok if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1&goto arg-ok if /i "%1"=="test-addons-napi" set test_args=%test_args% addons-napi&set build_addons_napi=1&goto arg-ok if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok