Use const/let in specs, not var
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
describe('StackTrace', function() {
|
||||
it('understands Chrome/Edge style traces', function() {
|
||||
var error = {
|
||||
const error = {
|
||||
message: 'nope',
|
||||
stack:
|
||||
'Error: nope\n' +
|
||||
@@ -8,7 +8,7 @@ describe('StackTrace', function() {
|
||||
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)'
|
||||
};
|
||||
|
||||
var result = new jasmineUnderTest.StackTrace(error);
|
||||
const result = new jasmineUnderTest.StackTrace(error);
|
||||
|
||||
expect(result.message).toEqual('Error: nope');
|
||||
expect(result.style).toEqual('v8');
|
||||
@@ -31,7 +31,7 @@ describe('StackTrace', function() {
|
||||
});
|
||||
|
||||
it('understands Chrome/Edge style traces with multiline messages', function() {
|
||||
var error = {
|
||||
const error = {
|
||||
message: 'line 1\nline 2',
|
||||
stack:
|
||||
'Error: line 1\nline 2\n' +
|
||||
@@ -39,10 +39,10 @@ describe('StackTrace', function() {
|
||||
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)'
|
||||
};
|
||||
|
||||
var result = new jasmineUnderTest.StackTrace(error);
|
||||
const result = new jasmineUnderTest.StackTrace(error);
|
||||
|
||||
expect(result.message).toEqual('Error: line 1\nline 2');
|
||||
var rawFrames = result.frames.map(function(f) {
|
||||
const rawFrames = result.frames.map(function(f) {
|
||||
return f.raw;
|
||||
});
|
||||
expect(rawFrames).toEqual([
|
||||
@@ -52,7 +52,7 @@ describe('StackTrace', function() {
|
||||
});
|
||||
|
||||
it('understands Node style traces', function() {
|
||||
var error = {
|
||||
const error = {
|
||||
message: 'nope',
|
||||
stack:
|
||||
'Error\n' +
|
||||
@@ -61,7 +61,7 @@ describe('StackTrace', function() {
|
||||
' at Immediate.<anonymous> (/somewhere/jasmine/lib/jasmine-core/jasmine.js:4314:12)\n' +
|
||||
' at runCallback (timers.js:672:20)'
|
||||
};
|
||||
var result = new jasmineUnderTest.StackTrace(error);
|
||||
const result = new jasmineUnderTest.StackTrace(error);
|
||||
|
||||
expect(result.message).toEqual('Error');
|
||||
expect(result.style).toEqual('v8');
|
||||
@@ -96,13 +96,13 @@ describe('StackTrace', function() {
|
||||
});
|
||||
|
||||
it('understands Safari <=14/Firefox/Phantom-OS X style traces', function() {
|
||||
var error = {
|
||||
const error = {
|
||||
message: 'nope',
|
||||
stack:
|
||||
'http://localhost:8888/__spec__/core/UtilSpec.js:115:28\n' +
|
||||
'run@http://localhost:8888/__jasmine__/jasmine.js:4320:27'
|
||||
};
|
||||
var result = new jasmineUnderTest.StackTrace(error);
|
||||
const result = new jasmineUnderTest.StackTrace(error);
|
||||
|
||||
expect(result.message).toBeFalsy();
|
||||
expect(result.style).toEqual('webkit');
|
||||
@@ -123,13 +123,13 @@ describe('StackTrace', function() {
|
||||
});
|
||||
|
||||
it('understands Safari 15 style traces', function() {
|
||||
var error = {
|
||||
const error = {
|
||||
message: 'nope',
|
||||
stack:
|
||||
'@http://localhost:8888/__spec__/core/FooSpec.js:164:24\n' +
|
||||
'attempt@http://localhost:8888/__jasmine__/jasmine.js:8074:44\n'
|
||||
};
|
||||
var result = new jasmineUnderTest.StackTrace(error);
|
||||
const result = new jasmineUnderTest.StackTrace(error);
|
||||
|
||||
expect(result.message).toBeFalsy();
|
||||
expect(result.style).toEqual('webkit');
|
||||
@@ -150,24 +150,24 @@ describe('StackTrace', function() {
|
||||
});
|
||||
|
||||
it('does not mistake gibberish for Safari/Firefox/Phantom-OS X style traces', function() {
|
||||
var error = {
|
||||
const error = {
|
||||
message: 'nope',
|
||||
stack: 'randomcharsnotincludingwhitespace'
|
||||
};
|
||||
var result = new jasmineUnderTest.StackTrace(error);
|
||||
const result = new jasmineUnderTest.StackTrace(error);
|
||||
expect(result.style).toBeNull();
|
||||
expect(result.frames).toEqual([{ raw: error.stack }]);
|
||||
});
|
||||
|
||||
it('understands Phantom-Linux style traces', function() {
|
||||
var error = {
|
||||
const error = {
|
||||
message: 'nope',
|
||||
stack:
|
||||
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n' +
|
||||
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)'
|
||||
};
|
||||
|
||||
var result = new jasmineUnderTest.StackTrace(error);
|
||||
const result = new jasmineUnderTest.StackTrace(error);
|
||||
|
||||
expect(result.message).toBeFalsy();
|
||||
expect(result.style).toEqual('v8');
|
||||
@@ -190,13 +190,13 @@ describe('StackTrace', function() {
|
||||
});
|
||||
|
||||
it('ignores blank lines', function() {
|
||||
var error = {
|
||||
const error = {
|
||||
message: 'nope',
|
||||
stack:
|
||||
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n'
|
||||
};
|
||||
|
||||
var result = new jasmineUnderTest.StackTrace(error);
|
||||
const result = new jasmineUnderTest.StackTrace(error);
|
||||
|
||||
expect(result.frames).toEqual([
|
||||
{
|
||||
@@ -210,7 +210,7 @@ describe('StackTrace', function() {
|
||||
});
|
||||
|
||||
it("omits properties except 'raw' for frames that are not understood", function() {
|
||||
var error = {
|
||||
const error = {
|
||||
message: 'nope',
|
||||
stack:
|
||||
' at UserContext.<anonymous> (http://localhost:8888/__spec__/core/UtilSpec.js:115:19)\n' +
|
||||
@@ -218,7 +218,7 @@ describe('StackTrace', function() {
|
||||
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)'
|
||||
};
|
||||
|
||||
var result = new jasmineUnderTest.StackTrace(error);
|
||||
const result = new jasmineUnderTest.StackTrace(error);
|
||||
expect(result.style).toEqual('v8');
|
||||
expect(result.frames).toEqual([
|
||||
{
|
||||
@@ -242,7 +242,7 @@ describe('StackTrace', function() {
|
||||
});
|
||||
|
||||
it('consideres different types of errors', function() {
|
||||
var error = {
|
||||
const error = {
|
||||
message: 'nope',
|
||||
stack:
|
||||
'TypeError: nope\n' +
|
||||
@@ -250,7 +250,7 @@ describe('StackTrace', function() {
|
||||
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)'
|
||||
};
|
||||
|
||||
var result = new jasmineUnderTest.StackTrace(error);
|
||||
const result = new jasmineUnderTest.StackTrace(error);
|
||||
|
||||
expect(result.message).toEqual('TypeError: nope');
|
||||
expect(result.frames).toEqual([
|
||||
@@ -270,7 +270,7 @@ describe('StackTrace', function() {
|
||||
}
|
||||
]);
|
||||
|
||||
var no_error = {
|
||||
const no_error = {
|
||||
message: 'nope',
|
||||
stack:
|
||||
'Type Error: nope\n' +
|
||||
@@ -278,7 +278,7 @@ describe('StackTrace', function() {
|
||||
' at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)'
|
||||
};
|
||||
|
||||
var result_no_error = new jasmineUnderTest.StackTrace(no_error);
|
||||
const result_no_error = new jasmineUnderTest.StackTrace(no_error);
|
||||
|
||||
expect(result_no_error.message).not.toEqual(jasmine.anything());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user