зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1295337 - New console frontend: Automate creation and update of stubs. r=bgrins
MozReview-Commit-ID: KtJLRAMqGVC --HG-- rename : devtools/client/webconsole/new-console-output/test/fixtures/stubs.js => devtools/client/webconsole/new-console-output/test/fixtures/stubs/consoleApi.js
This commit is contained in:
Родитель
79ff11951a
Коммит
1f90a0eb35
|
@ -3,7 +3,7 @@
|
|||
"use strict";
|
||||
|
||||
const { getRepeatId } = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
const { stubConsoleMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs");
|
||||
const stubConsoleMessages = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
const { setupActions } = require("devtools/client/webconsole/new-console-output/test/helpers");
|
||||
const constants = require("devtools/client/webconsole/new-console-output/constants");
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ const { renderComponent } = require("devtools/client/webconsole/new-console-outp
|
|||
const { ConsoleApiCall } = require("devtools/client/webconsole/new-console-output/components/message-types/console-api-call");
|
||||
|
||||
// Test fakes.
|
||||
const { stubConsoleMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs");
|
||||
const stubConsoleMessages = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
const onViewSourceInDebugger = () => {};
|
||||
|
||||
describe("ConsoleAPICall component:", () => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const { stubConsoleMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs");
|
||||
const stubConsoleMessages = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
const { EvaluationResult } = require("devtools/client/webconsole/new-console-output/components/message-types/evaluation-result");
|
||||
|
||||
const expect = require("expect");
|
||||
|
|
|
@ -16,7 +16,7 @@ const { EvaluationResult } = require("devtools/client/webconsole/new-console-out
|
|||
const { PageError } = require("devtools/client/webconsole/new-console-output/components/message-types/page-error");
|
||||
|
||||
// Test fakes.
|
||||
const { stubConsoleMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs");
|
||||
const stubConsoleMessages = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
const onViewSourceInDebugger = () => {};
|
||||
|
||||
describe("MessageContainer component:", () => {
|
||||
|
@ -38,7 +38,7 @@ describe("MessageContainer component:", () => {
|
|||
},
|
||||
{
|
||||
component: PageError,
|
||||
message: stubConsoleMessages.get("ReferenceError")
|
||||
message: stubConsoleMessages.get("ReferenceError: asdf is not defined")
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const { stubConsoleMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs");
|
||||
const stubConsoleMessages = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
|
||||
const { PageError } = require("devtools/client/webconsole/new-console-output/components/message-types/page-error");
|
||||
|
||||
|
@ -14,7 +14,7 @@ const {
|
|||
|
||||
describe("PageError component:", () => {
|
||||
it("renders a page error", () => {
|
||||
const message = stubConsoleMessages.get("ReferenceError");
|
||||
const message = stubConsoleMessages.get("ReferenceError: asdf is not defined");
|
||||
const rendered = renderComponent(PageError, {message});
|
||||
|
||||
const messageBody = getMessageBody(rendered);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DevToolsModules(
|
||||
'l10n.js',
|
||||
'stubs.js',
|
||||
)
|
||||
DIRS += [
|
||||
'stub-generators'
|
||||
]
|
||||
|
|
15
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser.ini
поставляемый
Normal file
15
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/browser.ini
поставляемый
Normal file
|
@ -0,0 +1,15 @@
|
|||
[DEFAULT]
|
||||
tags = devtools
|
||||
subsuite = devtools
|
||||
support-files =
|
||||
head.js
|
||||
!/devtools/client/framework/test/shared-head.js
|
||||
test-console-api.html
|
||||
test-tempfile.js
|
||||
|
||||
[browser_webconsole_update_stubs_console_api.js]
|
||||
skip-if=true # This is only used to update stubs. It is not an actual test.
|
||||
[browser_webconsole_update_stubs_evaluation_result.js]
|
||||
skip-if=true # This is only used to update stubs. It is not an actual test.
|
||||
[browser_webconsole_update_stubs_page_error.js]
|
||||
skip-if=true # This is only used to update stubs. It is not an actual test.
|
|
@ -0,0 +1,40 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
const { consoleApi: snippets } = require("devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/stub-snippets.js");
|
||||
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html";
|
||||
|
||||
let stubs = [];
|
||||
|
||||
snippets.forEach((code, key) => {
|
||||
add_task(function* () {
|
||||
let tempFilePath = OS.Path.join(`${BASE_PATH}/stub-generators`, "test-tempfile.js");
|
||||
OS.File.writeAtomic(tempFilePath, `function triggerPacket() {${code}}`);
|
||||
|
||||
let toolbox = yield openNewTabAndToolbox(TEST_URI, "webconsole");
|
||||
let hud = toolbox.getCurrentPanel().hud;
|
||||
let {ui} = hud;
|
||||
|
||||
ok(ui.jsterm, "jsterm exists");
|
||||
ok(ui.newConsoleOutput, "newConsoleOutput exists");
|
||||
|
||||
toolbox.target.client.addListener("consoleAPICall", (type, res) => {
|
||||
stubs.push(formatStub(key, res));
|
||||
if (stubs.length == snippets.size) {
|
||||
let filePath = OS.Path.join(`${BASE_PATH}/stubs`, "consoleApi.js");
|
||||
OS.File.writeAtomic(filePath, formatFile(stubs));
|
||||
OS.File.writeAtomic(tempFilePath, "");
|
||||
}
|
||||
});
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, {}, function() {
|
||||
content.wrappedJSObject.triggerPacket();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,29 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
const TEST_URI = "data:text/html;charset=utf-8,stub generation";
|
||||
|
||||
const { evaluationResult: snippets} = require("devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/stub-snippets.js");
|
||||
|
||||
let stubs = [];
|
||||
|
||||
add_task(function* () {
|
||||
let toolbox = yield openNewTabAndToolbox(TEST_URI, "webconsole");
|
||||
ok(true, "make the test not fail");
|
||||
|
||||
for (var [code,key] of snippets) {
|
||||
const packet = yield new Promise(resolve => {
|
||||
toolbox.target.activeConsole.evaluateJS(code, resolve);
|
||||
});
|
||||
stubs.push(formatStub(key, packet));
|
||||
if (stubs.length == snippets.size) {
|
||||
let filePath = OS.Path.join(`${BASE_PATH}/stubs`, "evaluationResult.js");
|
||||
OS.File.writeAtomic(filePath, formatFile(stubs));
|
||||
}
|
||||
}
|
||||
});
|
|
@ -0,0 +1,45 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
const TEST_URI = "data:text/html;charset=utf-8,stub generation";
|
||||
|
||||
const { pageError: snippets} = require("devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/stub-snippets.js");
|
||||
|
||||
let stubs = [];
|
||||
|
||||
add_task(function* () {
|
||||
let toolbox = yield openNewTabAndToolbox(TEST_URI, "webconsole");
|
||||
ok(true, "make the test not fail");
|
||||
|
||||
for (var [key,code] of snippets) {
|
||||
let received = new Promise(resolve => {
|
||||
toolbox.target.client.addListener("pageError", function onPacket(e, packet) {
|
||||
toolbox.target.client.removeListener("pageError", onPacket);
|
||||
info("Received page error:" + e + " " + JSON.stringify(packet, null, "\t"));
|
||||
|
||||
let message = prepareMessage(packet, {getNextId: () => 1});
|
||||
stubs.push(formatStub(message.messageText, packet));
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
info("Injecting script: " + code);
|
||||
|
||||
yield ContentTask.spawn(gBrowser.selectedBrowser, code, function(code) {
|
||||
let container = content.document.createElement("script");
|
||||
content.document.body.appendChild(container);
|
||||
container.textContent = code;
|
||||
content.document.body.removeChild(container);
|
||||
});
|
||||
|
||||
yield received;
|
||||
}
|
||||
|
||||
let filePath = OS.Path.join(`${BASE_PATH}/stubs`, "pageError.js");
|
||||
OS.File.writeAtomic(filePath, formatFile(stubs));
|
||||
});
|
47
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js
поставляемый
Normal file
47
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/head.js
поставляемый
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* import-globals-from ../../../../framework/test/shared-head.js */
|
||||
|
||||
"use strict";
|
||||
|
||||
// shared-head.js handles imports, constants, and utility functions
|
||||
// Load the shared-head file first.
|
||||
Services.scriptloader.loadSubScript(
|
||||
"chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js",
|
||||
this);
|
||||
|
||||
Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", true);
|
||||
registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("devtools.webconsole.new-frontend-enabled");
|
||||
});
|
||||
|
||||
const { prepareMessage } = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
|
||||
const BASE_PATH = "../../../../devtools/client/webconsole/new-console-output/test/fixtures";
|
||||
|
||||
function formatStub(key, message) {
|
||||
let prepared = prepareMessage(message, {getNextId: () => "1"});
|
||||
return `
|
||||
stubConsoleMessages.set("${key}", new ConsoleMessage(${JSON.stringify(prepared, null, "\t")}));
|
||||
`;
|
||||
}
|
||||
|
||||
function formatFile(stubs) {
|
||||
return `/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY BY HAND. RUN TESTS IN FIXTURES/ TO UPDATE.
|
||||
*/
|
||||
|
||||
const { ConsoleMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
|
||||
let stubConsoleMessages = new Map();
|
||||
${stubs.join("")}
|
||||
|
||||
module.exports = stubConsoleMessages`;
|
||||
}
|
8
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/moz.build
поставляемый
Normal file
8
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/moz.build
поставляемый
Normal file
|
@ -0,0 +1,8 @@
|
|||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DevToolsModules(
|
||||
'stub-snippets.js',
|
||||
)
|
58
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/stub-snippets.js
поставляемый
Normal file
58
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/stub-snippets.js
поставляемый
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Console API
|
||||
|
||||
const consoleApiCommands = [
|
||||
"console.log('foobar', 'test')",
|
||||
"console.log(undefined)",
|
||||
"console.warn('danger, will robinson!')",
|
||||
"console.log(NaN)",
|
||||
"console.log(null)",
|
||||
"console.clear()",
|
||||
"console.count('bar')",
|
||||
];
|
||||
|
||||
let consoleApi = new Map(consoleApiCommands.map(cmd => [cmd, cmd]));
|
||||
|
||||
consoleApi.set("console.trace()",
|
||||
`
|
||||
function bar() {
|
||||
console.trace()
|
||||
}
|
||||
function foo() {
|
||||
bar()
|
||||
}
|
||||
|
||||
foo()
|
||||
`);
|
||||
|
||||
consoleApi.set("console.time()",
|
||||
`
|
||||
console.time()
|
||||
console.timeEnd()
|
||||
`);
|
||||
|
||||
// Evaluation Result
|
||||
|
||||
const evaluationResultCommands = [
|
||||
"new Date(0)"
|
||||
];
|
||||
|
||||
let evaluationResult = new Map(evaluationResultCommands.map(cmd => [cmd, cmd]));
|
||||
|
||||
// Page Error
|
||||
|
||||
const pageErrorCommands = [
|
||||
"asdf()",
|
||||
];
|
||||
|
||||
let pageError = new Map(pageErrorCommands.map(cmd => [cmd, cmd]));
|
||||
|
||||
module.exports = {
|
||||
consoleApi,
|
||||
evaluationResult,
|
||||
pageError,
|
||||
};
|
11
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html
поставляемый
Normal file
11
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-console-api.html
поставляемый
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Stub generator</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Stub generator</p>
|
||||
<script src="test-tempfile.js"></script>
|
||||
</body>
|
||||
</html>
|
0
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js
поставляемый
Normal file
0
devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js
поставляемый
Normal file
|
@ -1,150 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
MESSAGE_SOURCE,
|
||||
MESSAGE_TYPE,
|
||||
MESSAGE_LEVEL,
|
||||
} = require("devtools/client/webconsole/new-console-output/constants");
|
||||
|
||||
const { ConsoleMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
|
||||
exports.stubConsoleMessages = new Map([
|
||||
[
|
||||
"console.log('foobar', 'test')",
|
||||
new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.CONSOLE_API,
|
||||
type: MESSAGE_TYPE.LOG,
|
||||
level: MESSAGE_LEVEL.LOG,
|
||||
messageText: null,
|
||||
parameters: ["foobar", "test"],
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
stacktrace: undefined
|
||||
})
|
||||
],
|
||||
[
|
||||
"console.warn('danger, will robinson!')",
|
||||
new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.CONSOLE_API,
|
||||
type: MESSAGE_TYPE.LOG,
|
||||
level: MESSAGE_LEVEL.WARN,
|
||||
messageText: null,
|
||||
parameters: ["danger, will robinson!"],
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
})
|
||||
],
|
||||
[
|
||||
"console.log(undefined)",
|
||||
new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.CONSOLE_API,
|
||||
type: MESSAGE_TYPE.LOG,
|
||||
level: MESSAGE_LEVEL.LOG,
|
||||
messageText: null,
|
||||
parameters: [
|
||||
{ type: "undefined" }
|
||||
],
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
})
|
||||
],
|
||||
[
|
||||
"console.log(NaN)",
|
||||
new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.CONSOLE_API,
|
||||
type: MESSAGE_TYPE.LOG,
|
||||
level: MESSAGE_LEVEL.LOG,
|
||||
messageText: null,
|
||||
parameters: [
|
||||
{ type: "NaN" }
|
||||
],
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
})
|
||||
],
|
||||
[
|
||||
"console.log(null)",
|
||||
new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.CONSOLE_API,
|
||||
type: MESSAGE_TYPE.LOG,
|
||||
level: MESSAGE_LEVEL.LOG,
|
||||
messageText: null,
|
||||
parameters: [
|
||||
{ type: "null" }
|
||||
],
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
})
|
||||
],
|
||||
[
|
||||
"console.clear()",
|
||||
new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.CONSOLE_API,
|
||||
type: MESSAGE_TYPE.CLEAR,
|
||||
level: MESSAGE_LEVEL.LOG,
|
||||
messageText: null,
|
||||
parameters: ["Console cleared."],
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
})
|
||||
],
|
||||
[
|
||||
"console.count('bar')",
|
||||
new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.CONSOLE_API,
|
||||
type: MESSAGE_TYPE.LOG,
|
||||
level: MESSAGE_LEVEL.DEBUG,
|
||||
messageText: "bar: 1",
|
||||
parameters: null,
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
})
|
||||
],
|
||||
[
|
||||
"new Date(0)",
|
||||
new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.JAVASCRIPT,
|
||||
type: MESSAGE_TYPE.RESULT,
|
||||
level: MESSAGE_LEVEL.LOG,
|
||||
messageText: null,
|
||||
parameters: {
|
||||
"type": "object",
|
||||
"class": "Date",
|
||||
"actor": "server2.conn0.obj115",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"timestamp": 0
|
||||
}
|
||||
},
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
})
|
||||
],
|
||||
[
|
||||
"ReferenceError",
|
||||
new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.JAVASCRIPT,
|
||||
type: MESSAGE_TYPE.LOG,
|
||||
level: MESSAGE_LEVEL.ERROR,
|
||||
messageText: "ReferenceError: asdf is not defined",
|
||||
parameters: null,
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
})
|
||||
]
|
||||
]);
|
|
@ -3,11 +3,9 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
MESSAGE_SOURCE,
|
||||
MESSAGE_TYPE,
|
||||
MESSAGE_LEVEL,
|
||||
} = require("devtools/client/webconsole/new-console-output/constants");
|
||||
/*
|
||||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY BY HAND. RUN TESTS IN FIXTURES/ TO UPDATE.
|
||||
*/
|
||||
|
||||
const { ConsoleMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
|
||||
|
@ -158,41 +156,45 @@ stubConsoleMessages.set("console.count('bar')", new ConsoleMessage({
|
|||
}
|
||||
}));
|
||||
|
||||
|
||||
// Temporarily hardcode these
|
||||
stubConsoleMessages.set("new Date(0)", new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.JAVASCRIPT,
|
||||
type: MESSAGE_TYPE.RESULT,
|
||||
level: MESSAGE_LEVEL.LOG,
|
||||
messageText: null,
|
||||
parameters: {
|
||||
"type": "object",
|
||||
"class": "Date",
|
||||
"actor": "server2.conn0.obj115",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"timestamp": 0
|
||||
stubConsoleMessages.set("console.trace()", new ConsoleMessage({
|
||||
"id": "1",
|
||||
"allowRepeating": true,
|
||||
"source": "console-api",
|
||||
"type": "trace",
|
||||
"level": "log",
|
||||
"messageText": null,
|
||||
"parameters": [],
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"console-api\",\"type\":\"trace\",\"level\":\"log\",\"messageText\":null,\"parameters\":[],\"repeatId\":null,\"stacktrace\":[{\"columnNumber\":3,\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"functionName\":\"bar\",\"language\":2,\"lineNumber\":3},{\"columnNumber\":3,\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"functionName\":\"foo\",\"language\":2,\"lineNumber\":6},{\"columnNumber\":1,\"filename\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"functionName\":\"triggerPacket\",\"language\":2,\"lineNumber\":9}],\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js\",\"line\":3,\"column\":3}}",
|
||||
"stacktrace": [
|
||||
{
|
||||
"columnNumber": 3,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"functionName": "bar",
|
||||
"language": 2,
|
||||
"lineNumber": 3
|
||||
},
|
||||
{
|
||||
"columnNumber": 3,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"functionName": "foo",
|
||||
"language": 2,
|
||||
"lineNumber": 6
|
||||
},
|
||||
{
|
||||
"columnNumber": 1,
|
||||
"filename": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"functionName": "triggerPacket",
|
||||
"language": 2,
|
||||
"lineNumber": 9
|
||||
}
|
||||
},
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
],
|
||||
"frame": {
|
||||
"source": "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js",
|
||||
"line": 3,
|
||||
"column": 3
|
||||
}
|
||||
}));
|
||||
|
||||
stubConsoleMessages.set("ReferenceError", new ConsoleMessage({
|
||||
allowRepeating: true,
|
||||
source: MESSAGE_SOURCE.JAVASCRIPT,
|
||||
type: MESSAGE_TYPE.LOG,
|
||||
level: MESSAGE_LEVEL.ERROR,
|
||||
messageText: "ReferenceError: asdf is not defined",
|
||||
parameters: null,
|
||||
repeat: 1,
|
||||
repeatId: null,
|
||||
}));
|
||||
|
||||
module.exports = {
|
||||
stubConsoleMessages
|
||||
}
|
||||
module.exports = stubConsoleMessages
|
40
devtools/client/webconsole/new-console-output/test/fixtures/stubs/evaluationResult.js
поставляемый
Normal file
40
devtools/client/webconsole/new-console-output/test/fixtures/stubs/evaluationResult.js
поставляемый
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY BY HAND. RUN TESTS IN FIXTURES/ TO UPDATE.
|
||||
*/
|
||||
|
||||
const { ConsoleMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
|
||||
let stubConsoleMessages = new Map();
|
||||
|
||||
stubConsoleMessages.set("new Date(0)", new ConsoleMessage({
|
||||
"id": "1",
|
||||
"allowRepeating": true,
|
||||
"source": "javascript",
|
||||
"type": "result",
|
||||
"level": "log",
|
||||
"messageText": null,
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"actor": "server1.conn0.child1/obj29",
|
||||
"class": "Date",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"timestamp": 0
|
||||
}
|
||||
},
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"javascript\",\"type\":\"result\",\"level\":\"log\",\"messageText\":null,\"parameters\":{\"type\":\"object\",\"actor\":\"server1.conn0.child1/obj29\",\"class\":\"Date\",\"extensible\":true,\"frozen\":false,\"sealed\":false,\"ownPropertyLength\":0,\"preview\":{\"timestamp\":0}},\"repeatId\":null,\"stacktrace\":null,\"frame\":null}",
|
||||
"stacktrace": null,
|
||||
"frame": null
|
||||
}));
|
||||
|
||||
|
||||
module.exports = stubConsoleMessages
|
22
devtools/client/webconsole/new-console-output/test/fixtures/stubs/index.js
поставляемый
Normal file
22
devtools/client/webconsole/new-console-output/test/fixtures/stubs/index.js
поставляемый
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
let maps = [];
|
||||
|
||||
[
|
||||
"consoleApi",
|
||||
"evaluationResult",
|
||||
"pageError",
|
||||
].forEach((filename) => {
|
||||
maps[filename] = require(`./${filename}`);
|
||||
});
|
||||
|
||||
// Combine all the maps into a single map.
|
||||
module.exports = new Map([
|
||||
...maps.consoleApi,
|
||||
...maps.evaluationResult,
|
||||
...maps.pageError,
|
||||
]);
|
||||
|
29
devtools/client/webconsole/new-console-output/test/fixtures/stubs/pageError.js
поставляемый
Normal file
29
devtools/client/webconsole/new-console-output/test/fixtures/stubs/pageError.js
поставляемый
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* THIS FILE IS AUTOGENERATED. DO NOT MODIFY BY HAND. RUN TESTS IN FIXTURES/ TO UPDATE.
|
||||
*/
|
||||
|
||||
const { ConsoleMessage } = require("devtools/client/webconsole/new-console-output/types");
|
||||
|
||||
let stubConsoleMessages = new Map();
|
||||
|
||||
stubConsoleMessages.set("ReferenceError: asdf is not defined", new ConsoleMessage({
|
||||
"id": "1",
|
||||
"allowRepeating": true,
|
||||
"source": "javascript",
|
||||
"type": "log",
|
||||
"level": "error",
|
||||
"messageText": "ReferenceError: asdf is not defined",
|
||||
"parameters": null,
|
||||
"repeat": 1,
|
||||
"repeatId": "{\"id\":null,\"allowRepeating\":true,\"source\":\"javascript\",\"type\":\"log\",\"level\":\"error\",\"messageText\":\"ReferenceError: asdf is not defined\",\"parameters\":null,\"repeatId\":null,\"stacktrace\":null,\"frame\":null}",
|
||||
"stacktrace": null,
|
||||
"frame": null
|
||||
}));
|
||||
|
||||
|
||||
module.exports = stubConsoleMessages
|
|
@ -10,7 +10,7 @@ var TestUtils = React.addons.TestUtils;
|
|||
const actions = require("devtools/client/webconsole/new-console-output/actions/messages");
|
||||
const { configureStore } = require("devtools/client/webconsole/new-console-output/store");
|
||||
const { IdGenerator } = require("devtools/client/webconsole/new-console-output/utils/id-generator");
|
||||
const { stubConsoleMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs");
|
||||
const stubConsoleMessages = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
|
||||
/**
|
||||
* Prepare actions for use in testing.
|
||||
|
|
|
@ -3,12 +3,15 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += ['mochitest/browser.ini']
|
||||
BROWSER_CHROME_MANIFESTS += [
|
||||
'fixtures/stub-generators/browser.ini',
|
||||
'mochitest/browser.ini',
|
||||
]
|
||||
|
||||
DIRS += [
|
||||
'fixtures'
|
||||
]
|
||||
|
||||
MOCHITEST_CHROME_MANIFESTS += [
|
||||
'chrome/chrome.ini'
|
||||
'chrome/chrome.ini',
|
||||
]
|
||||
|
|
|
@ -24,7 +24,7 @@ describe("Filtering", () => {
|
|||
// Evaluation Result
|
||||
"new Date(0)",
|
||||
// PageError
|
||||
"ReferenceError"
|
||||
"ReferenceError: asdf is not defined"
|
||||
]);
|
||||
// Console Command
|
||||
store.dispatch(messageAdd(new ConsoleCommand({ messageText: `console.warn("x")` })));
|
||||
|
|
|
@ -8,7 +8,7 @@ const {
|
|||
setupActions,
|
||||
setupStore
|
||||
} = require("devtools/client/webconsole/new-console-output/test/helpers");
|
||||
const { stubConsoleMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs");
|
||||
const stubConsoleMessages = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
|
||||
const expect = require("expect");
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"use strict";
|
||||
|
||||
const { getRepeatId } = require("devtools/client/webconsole/new-console-output/utils/messages");
|
||||
const { stubConsoleMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs");
|
||||
const stubConsoleMessages = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
|
||||
|
||||
const expect = require("expect");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче