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

Side by Side Diff: chrome/test/data/webui/mocha_adapter.js

Issue 2072643002: MD Settings: animation interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase why not Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/settings/animation_browsertest.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview A mocha adapter for BrowserTests. To use, include mocha.js and 6 * @fileoverview A mocha adapter for BrowserTests. To use, include mocha.js and
7 * mocha_adapter.js in a WebUIBrowserTest's extraLibraries array. 7 * mocha_adapter.js in a WebUIBrowserTest's extraLibraries array.
8 */ 8 */
9 9
10 // NOTE: When defining TEST_F() functions that use Mocha, use 'var self = this' 10 // NOTE: When defining TEST_F() functions that use Mocha, use 'var self = this'
(...skipping 17 matching lines...) Expand all
28 passes++; 28 passes++;
29 }); 29 });
30 30
31 // Report failures. Mocha only catches "assert" failures, because "expect" 31 // Report failures. Mocha only catches "assert" failures, because "expect"
32 // failures are caught by test_api.js. 32 // failures are caught by test_api.js.
33 runner.on('fail', function(test, err) { 33 runner.on('fail', function(test, err) {
34 failures++; 34 failures++;
35 var message = 'Mocha test failed: ' + test.fullTitle() + '\n'; 35 var message = 'Mocha test failed: ' + test.fullTitle() + '\n';
36 36
37 // Remove unhelpful mocha lines from stack trace. 37 // Remove unhelpful mocha lines from stack trace.
38 var stack = err.stack.split('\n'); 38 if (err.stack) {
39 for (var i = 0; i < stack.length; i++) { 39 var stack = err.stack.split('\n');
40 if (stack[i].indexOf('mocha.js:') == -1) 40 for (var i = 0; i < stack.length; i++) {
41 message += stack[i] + '\n'; 41 if (stack[i].indexOf('mocha.js:') == -1)
42 message += stack[i] + '\n';
43 }
44 } else {
45 message += err.toString();
42 } 46 }
43 47
44 console.error(message); 48 console.error(message);
45 }); 49 });
46 50
47 // Report the results to the test API. 51 // Report the results to the test API.
48 runner.on('end', function() { 52 runner.on('end', function() {
49 if (failures == 0) { 53 if (failures == 0) {
50 if (passes > 0) 54 if (passes > 0)
51 testDone(); 55 testDone();
(...skipping 13 matching lines...) Expand all
65 mocha.setup({ 69 mocha.setup({
66 // Use TDD interface instead of BDD. 70 // Use TDD interface instead of BDD.
67 ui: 'tdd', 71 ui: 'tdd',
68 // Use custom reporter to interface with BrowserTests. 72 // Use custom reporter to interface with BrowserTests.
69 reporter: BrowserTestReporter, 73 reporter: BrowserTestReporter,
70 // Mocha timeouts are set to 2 seconds initially. This isn't nearly enough for 74 // Mocha timeouts are set to 2 seconds initially. This isn't nearly enough for
71 // slower bots (e.g., Dr. Memory). Disable timeouts globally, because the C++ 75 // slower bots (e.g., Dr. Memory). Disable timeouts globally, because the C++
72 // will handle it (and has scaled timeouts for slower bots). 76 // will handle it (and has scaled timeouts for slower bots).
73 enableTimeouts: false, 77 enableTimeouts: false,
74 }); 78 });
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/settings/animation_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698