summaryrefslogtreecommitdiff
path: root/deps/v8/test/inspector/runtime/es6-module.js
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2017-05-02 10:50:00 +0200
committerMichaël Zasso <targos@protonmail.com>2017-05-06 20:02:35 +0200
commit60d1aac8d225e844e68ae48e8f3d58802e635fbe (patch)
tree922f347dd054db18d88666fad7181e5a777f4022 /deps/v8/test/inspector/runtime/es6-module.js
parent73d9c0f903ae371cd5011af64c3a6f69a1bda978 (diff)
downloadnode-new-60d1aac8d225e844e68ae48e8f3d58802e635fbe.tar.gz
deps: update V8 to 5.8.283.38
PR-URL: https://github.com/nodejs/node/pull/12784 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'deps/v8/test/inspector/runtime/es6-module.js')
-rw-r--r--deps/v8/test/inspector/runtime/es6-module.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/deps/v8/test/inspector/runtime/es6-module.js b/deps/v8/test/inspector/runtime/es6-module.js
new file mode 100644
index 0000000000..e4e468ee5d
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/es6-module.js
@@ -0,0 +1,61 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+print('Checks basic ES6 modules support.');
+
+var module1 = `
+export function foo() {
+ console.log('module1');
+ return 42;
+}
+export let a1 = 1`;
+
+var module2 = `
+export function foo() {
+ console.log('module2');
+ return 239;
+}
+export let a2 = 2`;
+
+var module3 = `
+import { foo as foo1 } from 'module1';
+import { foo as foo2 } from 'module2';
+console.log(foo1());
+console.log(foo2());
+import { a1 } from 'module1';
+import { a2 } from 'module2';
+debugger;
+`;
+
+var module4 = '}';
+
+InspectorTest.setupScriptMap();
+// We get scriptParsed events for modules ..
+Protocol.Debugger.onScriptParsed(InspectorTest.logMessage);
+// .. scriptFailed to parse for modules with syntax error ..
+Protocol.Debugger.onScriptFailedToParse(InspectorTest.logMessage);
+// .. API messages from modules contain correct stack trace ..
+Protocol.Runtime.onConsoleAPICalled(message => {
+ InspectorTest.log(`console.log(${message.params.args[0].value})`);
+ InspectorTest.logCallFrames(message.params.stackTrace.callFrames);
+ InspectorTest.log('');
+});
+// .. we could break inside module and scope contains correct list of variables ..
+Protocol.Debugger.onPaused(message => {
+ InspectorTest.logMessage(message);
+ Protocol.Runtime.getProperties({ objectId: message.params.callFrames[0].scopeChain[0].object.objectId})
+ .then(InspectorTest.logMessage)
+ .then(() => Protocol.Debugger.resume());
+});
+// .. we process uncaught errors from modules correctly.
+Protocol.Runtime.onExceptionThrown(InspectorTest.logMessage);
+
+Protocol.Runtime.enable();
+Protocol.Debugger.enable()
+ .then(() => InspectorTest.addModule(module1, "module1"))
+ .then(() => InspectorTest.addModule(module2, "module2"))
+ .then(() => InspectorTest.addModule(module3, "module3"))
+ .then(() => InspectorTest.addModule(module4, "module4"))
+ .then(() => InspectorTest.waitPendingTasks())
+ .then(InspectorTest.completeTest);