We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53cf9fe commit b852648Copy full SHA for b852648
1 file changed
test/utils.js
@@ -46,16 +46,22 @@ exports.compareError = function compareError(actual, expected) {
46
47
exports.compareWarnings = function compareWarnings(actual, expected) {
48
assert.deepEqual(
49
- actual.map(normaliseError),
50
- expected.map(warning => {
51
- if (warning.frame) {
52
- warning.frame = deindent(warning.frame);
53
- }
54
- return warning;
55
- })
+ actual.map(normaliseError).sort(sortWarnings),
+ expected
+ .map(warning => {
+ if (warning.frame) {
+ warning.frame = deindent(warning.frame);
+ }
+ return warning;
56
+ })
57
+ .sort(sortWarnings)
58
);
59
};
60
61
+function sortWarnings(a, b) {
62
+ return a === b ? 0 : a < b ? -1 : 1;
63
+}
64
+
65
function deindent(stringValue) {
66
return stringValue.slice(1).replace(/^\t+/gm, '').replace(/\s+$/gm, '').trim();
67
}
0 commit comments