Skip to content

Feature/Stringify #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"version": "0.1.0",
"configurations": [
{
"name": "Test",
"request": "launch",
"type": "node",
"program": "node_modules/.bin/_mocha",
"args": [
"dist/temp/exceptionless-spec.js"
],
"runtimeArgs": [
"--nolazy"
],
"sourceMaps": true,
"outDir": "dist"
},
{
"name": "Attach",
"request": "attach",
"type": "node",
"port": 5858,
"sourceMaps": true,
"outDir": "dist"
}
]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.insertFinalNewline": true
}
64 changes: 64 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"args": [
"--no-color"
],
"tasks": [
{
"taskName": "build",
"args": [],
"isBuildCommand": true,
"problemMatcher": {
// The problem is owned by the cpp language service.
"owner": "typescript",
// The file name for reported problems is relative to the opened folder.
"fileLocation": [
"relative",
"${workspaceRoot}/src"
],
// The actual pattern to match problems in the output.
"pattern": {
// The regular expression. Example to match: helloWorld.c:5:3: warning: implicit declaration of function ‘prinft’ [-Wimplicit-function-declaration]
"regexp": "\\[\\d\\d:\\d\\d:\\d\\d\\] \\[gulp-tslint\\] error \\([^)]+\\) ([^\\[]+)\\[(\\d+), (\\d+)\\]: (.+)$",
// The first match group matches the file name which is relative.
"file": 1,
// The second match group matches the line on which the problem occurred.
"line": 2,
// The third match group matches the column at which the problem occurred.
"column": 3,
// The fifth match group matches the message.
"message": 4
}
}
},
{
"taskName": "test",
"args": [],
"isBuildCommand": true,
"problemMatcher": {
// The problem is owned by the cpp language service.
"owner": "typescript",
// The file name for reported problems is relative to the opened folder.
"fileLocation": [
"relative",
"${workspaceRoot}/src"
],
// The actual pattern to match problems in the output.
"pattern": {
// The regular expression. Example to match: helloWorld.c:5:3: warning: implicit declaration of function ‘prinft’ [-Wimplicit-function-declaration]
"regexp": "\\[\\d\\d:\\d\\d:\\d\\d\\] \\[gulp-tslint\\] error \\([^)]+\\) ([^\\[]+)\\[(\\d+), (\\d+)\\]: (.+)$",
// The first match group matches the file name which is relative.
"file": 1,
// The second match group matches the line on which the problem occurred.
"line": 2,
// The third match group matches the column at which the problem occurred.
"column": 3,
// The fifth match group matches the message.
"message": 4
}
}
}
]
}
11 changes: 11 additions & 0 deletions dist/exceptionless.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/exceptionless.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/exceptionless.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/exceptionless.min.js.map

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions dist/exceptionless.node.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/exceptionless.node.js.map

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,14 @@ gulp.task('exceptionless.test.umd', ['typescript.test'], function () {
});

gulp.task('test', ['exceptionless.test.umd'], function(done) {
var Server = require('karma').Server;
new Server({
configFile: __dirname + '/karma.conf.js'
}, done).start();
var mocha = require('gulp-mocha');
return gulp.src('dist/temp/exceptionless-spec.js', { read: false })
.pipe(mocha({
require: ['source-map-support/register']
}))
.once('end', function () {
process.exit();
});
});

gulp.task('format', function () {
Expand Down
30 changes: 0 additions & 30 deletions karma.conf.js

This file was deleted.

10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,21 @@
},
"devDependencies": {
"bower": "1.6.5",
"chai": "^3.4.1",
"del": "2.1.0",
"es5-shim": "4.3.1",
"es6-shim": "0.33.13",
"gulp": "3.9.0",
"gulp-concat": "2.6.0",
"gulp-exec": "^2.1.2",
"gulp-mocha": "^2.2.0",
"gulp-replace": "0.5.4",
"gulp-sourcemaps": "1.6.0",
"gulp-tslint": "3.6.0",
"gulp-uglify": "1.5.1",
"gulp-wrap-umd": "0.2.1",
"jasmine-core": "2.3.4",
"karma": "0.13.15",
"karma-chrome-launcher": "^0.2.1",
"karma-cli": "0.1.1",
"karma-jasmine": "0.3.6",
"karma-phantomjs-launcher": "0.2.1",
"phantomjs": "^1.9.18",
"rimraf": "2.4.3",
"source-map-support": "^0.3.3",
"tracekit": "0.3.1",
"tsproject": "1.0.5",
"typescript": "1.6.2",
Expand Down
32 changes: 17 additions & 15 deletions src/ExceptionlessClient-spec.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,57 @@
import { ExceptionlessClient } from './ExceptionlessClient';
import { EventPluginContext } from './plugins/EventPluginContext';
import { expect } from 'chai';

describe('ExceptionlessClient', () => {
it('should use event reference ids', (done) => {
let error = new Error('From Unit Test');

let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
expect(client.config.lastReferenceIdManager.getLast()).toBe(null);
expect(client.config.lastReferenceIdManager.getLast()).to.be.null;
client.submitException(error, (context: EventPluginContext) => {
expect(client.config.lastReferenceIdManager.getLast()).toBe(null);
expect(client.config.lastReferenceIdManager.getLast()).to.be.null;
});

let numberOfPlugins = client.config.plugins.length;
client.config.useReferenceIds();
expect(client.config.plugins.length).toBe(numberOfPlugins + 1);
expect(client.config.plugins.length).to.equal(numberOfPlugins + 1);

client.submitException(error, (context: EventPluginContext) => {
if (!context.cancelled) {
expect(client.config.lastReferenceIdManager.getLast()).not.toBe(null);
expect(client.config.lastReferenceIdManager.getLast()).not.to.be.null;
} else {
expect(client.config.lastReferenceIdManager.getLast()).toBe(null);
expect(client.config.lastReferenceIdManager.getLast()).to.be.null;
}

done();
done = () => { };
});
}, 5000);
});

it('should accept null source', () => {
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
let builder = client.createLog(null, 'Unit Test message', 'Trace');

expect(builder.target.source).toBeUndefined();
expect(builder.target.message).toBe('Unit Test message');
expect(builder.target.data['@level']).toBe('Trace');
expect(builder.target.source).to.be.undefined;
expect(builder.target.message).to.equal('Unit Test message');
expect(builder.target.data['@level']).to.equal('Trace');
});

it('should accept source and message', () => {
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
let builder = client.createLog('ExceptionlessClient', 'Unit Test message');

expect(builder.target.source).toBe('ExceptionlessClient');
expect(builder.target.message).toBe('Unit Test message');
expect(builder.target.data).toBeUndefined();
expect(builder.target.source).to.equal('ExceptionlessClient');
expect(builder.target.message).to.equal('Unit Test message');
expect(builder.target.data).to.be.undefined;
});

it('should accept source and message', () => {
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
let builder = client.createLog('Unit Test message');

expect(builder.target.source).toBeUndefined();
expect(builder.target.message).toBe('Unit Test message');
expect(builder.target.data).toBeUndefined();
expect(builder.target.source).to.be.undefined;
expect(builder.target.message).to.equal('Unit Test message');
expect(builder.target.data).to.be.undefined;
});
});
Loading