This repository has been archived by the owner on Nov 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
276 additions
and
232 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,7 @@ | |
* Copyright(c) 2013-2016 Denis Bardadym <[email protected]> | ||
* MIT Licensed | ||
*/ | ||
|
||
var util = require('./util'); | ||
import { merge, format, functionName } from './util'; | ||
|
||
/** | ||
* should AssertionError | ||
|
@@ -14,8 +13,8 @@ var util = require('./util'); | |
* @memberOf should | ||
* @static | ||
*/ | ||
var AssertionError = function AssertionError(options) { | ||
util.merge(this, options); | ||
export default function AssertionError(options) { | ||
merge(this, options); | ||
|
||
if (!options.message) { | ||
Object.defineProperty(this, 'message', { | ||
|
@@ -42,7 +41,7 @@ var AssertionError = function AssertionError(options) { | |
|
||
if (this.stackStartFunction) { | ||
// try to strip useless frames | ||
var fn_name = util.functionName(this.stackStartFunction); | ||
var fn_name = functionName(this.stackStartFunction); | ||
var idx = out.indexOf('\n' + fn_name); | ||
if (idx >= 0) { | ||
// once we have located the function frame | ||
|
@@ -55,7 +54,7 @@ var AssertionError = function AssertionError(options) { | |
this.stack = out; | ||
} | ||
} | ||
}; | ||
} | ||
|
||
|
||
var indent = ' '; | ||
|
@@ -79,8 +78,8 @@ AssertionError.prototype = Object.create(Error.prototype, { | |
if (!this.operator && this.previous) { | ||
return this.previous.message; | ||
} | ||
var actual = util.format(this.actual); | ||
var expected = 'expected' in this ? ' ' + util.format(this.expected) : ''; | ||
var actual = format(this.actual); | ||
var expected = 'expected' in this ? ' ' + format(this.expected) : ''; | ||
var details = 'details' in this && this.details ? ' (' + this.details + ')' : ''; | ||
|
||
var previous = this.previous ? '\n' + indentLines(this.previous.message) : ''; | ||
|
@@ -89,5 +88,3 @@ AssertionError.prototype = Object.create(Error.prototype, { | |
} | ||
} | ||
}); | ||
|
||
module.exports = AssertionError; |
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
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
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
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
Oops, something went wrong.