Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: test/inspector/runtime/es6-module.js

Issue 2663743002: [inspector] added test infrastructure and test for es6 modules (Closed)
Patch Set: addressed comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/inspector/protocol-test.js ('k') | test/inspector/runtime/es6-module-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/runtime/es6-module.js
diff --git a/test/inspector/runtime/es6-module.js b/test/inspector/runtime/es6-module.js
new file mode 100644
index 0000000000000000000000000000000000000000..362ca3b72de0976edc37224ad3eb2f07043d953c
--- /dev/null
+++ b/test/inspector/runtime/es6-module.js
@@ -0,0 +1,64 @@
+// 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(message => {
+ if (message.params.url === 'wait-pending-tasks.js') return;
+ InspectorTest.logMessage(message);
+});
+// .. 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);
« no previous file with comments | « test/inspector/protocol-test.js ('k') | test/inspector/runtime/es6-module-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698