Skip to content

Commit 8f8cc9e

Browse files
committed
Initial work to get the unit tests working with TypeScript 1.5
1 parent cdde4bb commit 8f8cc9e

13 files changed

+136
-53
lines changed

dist/exceptionless.js

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,25 @@ gulp.task('watch', ['build'], function() {
9090

9191
gulp.task('build', ['clean', 'exceptionless.es5']);
9292

93-
gulp.task('test', [], function() {
94-
return gulp.src(['src/**/*-spec.ts'])
93+
gulp.task('typescript.test', function() {
94+
return tsProject.src('src/tsconfig.test.json').pipe(gulp.dest('dist/temp'));
95+
});
96+
97+
gulp.task('exceptionless.test.umd', ['typescript.test'], function() {
98+
return gulp.src('dist/temp/src/exceptionless-spec.js')
99+
.pipe(sourcemaps.init({ loadMaps: true }))
100+
.pipe(umd({
101+
exports: 'exports',
102+
globalName: 'Exceptionless',
103+
namespace: 'Exceptionless'
104+
}))
105+
.pipe(replace('}(this, function(require, exports, module) {', '}(this, function(require, exports, module) {\nif (!exports) {\n\tvar exports = {};\n}\nif (!require) {\n\tvar require = function(){};\n}\n'))
106+
.pipe(sourcemaps.write('.'))
107+
.pipe(gulp.dest('dist/temp'));
108+
});
109+
110+
gulp.task('test', ['exceptionless.test.umd'], function() {
111+
return gulp.src(['dist/temp/exceptionless-spec.js'])
95112
.pipe(karma({
96113
configFile: 'karma.conf.js',
97114
action: 'run'

karma.conf.js

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,9 @@ module.exports = function (config) {
88
frameworks: ['jasmine'],
99
files: [
1010
'../node_modules/es5-shim/es5-shim.js',
11-
'../node_modules/es6-shim/es6-shim.js',
12-
'../node_modules/es6-promise/dist/es6-promise.js',
13-
'../node_modules/stackframe/dist/stackframe.js',
14-
'../node_modules/error-stack-parser/dist/error-stack-parser.js',
15-
'../node_modules/stack-generator/dist/stack-generator.js',
16-
'../node_modules/stacktrace-gps/dist/stacktrace-gps.js',
17-
'../node_modules/stacktrace-js/dist/stacktrace.js',
18-
'**/*.ts'
11+
'../node_modules/es6-shim/es6-shim.js'
1912
],
2013
exclude: [],
21-
preprocessors: {
22-
'**/*.ts': ['typescript']
23-
},
24-
typescriptPreprocessor: {
25-
options: {
26-
module: 'amd',
27-
noResolve: true,
28-
sourceMap: true,
29-
target: 'ES5'
30-
},
31-
typings: [
32-
'typings/tsd.d.ts'
33-
],
34-
transformPath: function(path) {
35-
return path.replace(/\.ts$/, '.js');
36-
}
37-
},
3814
reporters: ['progress'],
3915
port: 9876,
4016
colors: true,

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@
3030
"gulp-sourcemaps": "^1.5.2",
3131
"gulp-uglify": "^1.2.0",
3232
"gulp-wrap-umd": "^0.2.1",
33-
"jasmine-core": "^2.3.3",
33+
"jasmine-core": "^2.3.4",
3434
"karma": "~0.12.31",
35-
"karma-chrome-launcher": "^0.1.11",
35+
"karma-chrome-launcher": "^0.1.12",
3636
"karma-cli": "0.0.4",
3737
"karma-jasmine": "~0.3.5",
38-
"karma-typescript-preprocessor": "0.0.19",
3938
"rimraf": "^2.3.3",
4039
"tsproject": "^0.8.8",
4140
"typescript": "1.5.0-beta"

src/bootstrap/NodeBootstrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class NodeBootstrapper implements IBootstrapper {
2525
ExceptionlessClient.default.submitUnhandledException(error, 'uncaughtException');
2626
});
2727

28-
process.on('beforeExit', function(code:number) {
28+
process.on('beforeExit', (code:number) => {
2929
var client = ExceptionlessClient.default;
3030

3131
var message = this.getExitCodeReason(code);

src/configuration/Configuration.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IConfigurationSettings } from 'IConfigurationSettings';
1+
import { IConfigurationSettings } from './IConfigurationSettings';
22
import { ILastReferenceIdManager } from '../lastReferenceIdManager/ILastReferenceIdManager';
33
import { InMemoryLastReferenceIdManager } from '../lastReferenceIdManager/InMemoryLastReferenceIdManager';
44
import { ConsoleLog } from '../logging/ConsoleLog';
@@ -69,7 +69,7 @@ export class Configuration implements IConfigurationSettings {
6969

7070
public set apiKey(value:string) {
7171
this._apiKey = value || null;
72-
this.log.info(`apiKey set to: ${this._apiKey}`);
72+
this.log.info(`apiKey: ${this._apiKey}`);
7373
}
7474

7575
public get serverUrl(): string {
@@ -79,7 +79,7 @@ export class Configuration implements IConfigurationSettings {
7979
public set serverUrl(value:string) {
8080
if (!!value && value.length > 0) {
8181
this._serverUrl = value;
82-
this.log.info(`serverUrl set to: ${this._serverUrl}`);
82+
this.log.info(`serverUrl: ${this._serverUrl}`);
8383
}
8484
}
8585

@@ -98,7 +98,7 @@ export class Configuration implements IConfigurationSettings {
9898
public addPlugin(pluginOrName:IEventPlugin|string, priority?:number, pluginAction?:(context:EventPluginContext) => void): void {
9999
var plugin:IEventPlugin = !!pluginAction ? { name: <string>pluginOrName, priority: priority, run: pluginAction } : <IEventPlugin>pluginOrName;
100100
if (!plugin || !plugin.run) {
101-
this.log.error('Unable to add plugin: No run method was found.');
101+
this.log.error('Add plugin failed: No run method was defined.');
102102
return;
103103
}
104104

@@ -128,7 +128,7 @@ export class Configuration implements IConfigurationSettings {
128128
public removePlugin(pluginOrName:IEventPlugin|string): void {
129129
var name:string = typeof pluginOrName === 'string' ? pluginOrName : pluginOrName.name;
130130
if (!name) {
131-
this.log.error('Unable to remove plugin: No plugin name was specified.');
131+
this.log.error('Remove plugin failed: No plugin name was defined.');
132132
return;
133133
}
134134

@@ -158,7 +158,7 @@ export class Configuration implements IConfigurationSettings {
158158
this.defaultData['@user'] = userInfo;
159159
}
160160

161-
this.log.info(`user identity set to: ${shouldRemove ? 'null' : userInfo.identity}`);
161+
this.log.info(`user identity: ${shouldRemove ? 'null' : userInfo.identity}`);
162162
}
163163

164164
public useReferenceIds(): void {

src/plugins/EventPluginManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class EventPluginManager {
1717
plugin.run(context, next);
1818
} catch (ex) {
1919
context.log.error(`Error while running plugin '${plugin.name}': ${ex.message}. This event will be discarded.`);
20+
2021
}
2122
};
2223
};

0 commit comments

Comments
 (0)