-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix comments, remove and add some code for karma
- Loading branch information
1 parent
3ecf2b9
commit d668af2
Showing
10 changed files
with
514 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-env node */ | ||
|
||
'use strict'; | ||
|
||
// By default, fixtures are loaded from spec/javascripts/fixtures but in karma everything gets served from /base | ||
jasmine.getFixtures().fixturesPath = '/base/'; | ||
|
||
// https://github.com/edx/js-test-tool/blob/master/js_test_tool/templates/jasmine_test_runner.html#L10 | ||
// Stub out modal dialog alerts, which will prevent | ||
// us from accessing the test results in the DOM | ||
window.confirm = function() { return true; }; | ||
window.alert = function() { }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* This file overrides ExceptionFormatter of jasmine before it's initialization in karma-jasmine's | ||
boot.js. It's important because ExceptionFormatter returns a constructor function. Once the method has been | ||
initialized we can't override the ExceptionFormatter as Jasmine then uses the stored reference to the function */ | ||
(function() { | ||
/* globals jasmineRequire */ | ||
|
||
'use strict'; | ||
|
||
var OldExceptionFormatter = jasmineRequire.ExceptionFormatter(), | ||
oldExceptionFormatter = new OldExceptionFormatter(), | ||
MAX_STACK_TRACE_LINES = 10; | ||
|
||
jasmineRequire.ExceptionFormatter = function() { | ||
function ExceptionFormatter() { | ||
this.message = oldExceptionFormatter.message; | ||
this.stack = function(error) { | ||
var errorMsg = null; | ||
|
||
if (error) { | ||
errorMsg = error.stack.split('\n').slice(0, MAX_STACK_TRACE_LINES).join('\n'); | ||
} | ||
|
||
return errorMsg; | ||
}; | ||
} | ||
|
||
return ExceptionFormatter; | ||
}; | ||
}()); |
Oops, something went wrong.