Skip to content

Commit e323c07

Browse files
committed
refactor(benchpress): convert src and test to typescript
Fixes angular#2007
1 parent f9908cd commit e323c07

File tree

79 files changed

+3055
-3295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3055
-3295
lines changed

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ gulp.task('test.unit.dart/ci', function (done) {
475475

476476

477477
gulp.task('test.unit.cjs/ci', function(done) {
478-
runJasmineTests(['dist/js/cjs/angular2/test/**/*_spec.js'], done);
478+
runJasmineTests(['dist/js/cjs/{angular2,benchpress}/test/**/*_spec.js'], done);
479479
});
480480

481481

modules/angular2/src/facade/lang.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ export function CONST() {
4343
return (target) => target;
4444
}
4545

46-
export class ABSTRACT {}
46+
export function ABSTRACT() {
47+
return (t) => t;
48+
}
4749

4850
// Note: This is only a marker annotation needed for ts2dart.
4951
// This is written so that is can be used as a Traceur annotation

modules/benchpress/benchpress.es6 renamed to modules/benchpress/benchpress.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { bind } from 'angular2/di';
2-
import { Options } from './common';
1+
/// <reference path="../angular2/typings/node/node.d.ts" />
2+
3+
import {bind} from 'angular2/di';
4+
import {Options} from './common';
35

46
export * from './common';
5-
export { SeleniumWebDriverAdapter } from './src/webdriver/selenium_webdriver_adapter';
7+
export {SeleniumWebDriverAdapter} from './src/webdriver/selenium_webdriver_adapter';
68

79
var fs = require('fs');
810

@@ -11,11 +13,9 @@ var fs = require('fs');
1113
// find another way...
1214
// Note: Can't do the `require` call in a facade as it can't be loaded into the browser
1315
// for our unit tests via karma.
14-
Options.DEFAULT_BINDINGS.push(
15-
bind(Options.WRITE_FILE).toValue(writeFile)
16-
);
16+
Options.DEFAULT_BINDINGS.push(bind(Options.WRITE_FILE).toValue(writeFile));
1717

18-
function writeFile(filename, content) {
18+
function writeFile(filename, content): Promise<any> {
1919
return new Promise(function(resolve, reject) {
2020
fs.writeFile(filename, content, (error) => {
2121
if (error) {

modules/benchpress/common.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

modules/benchpress/common.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export {Sampler, SampleState} from './src/sampler';
2+
export {Metric} from './src/metric';
3+
export {Validator} from './src/validator';
4+
export {Reporter} from './src/reporter';
5+
export {WebDriverExtension, PerfLogFeatures} from './src/web_driver_extension';
6+
export {WebDriverAdapter} from './src/web_driver_adapter';
7+
export {SizeValidator} from './src/validator/size_validator';
8+
export {RegressionSlopeValidator} from './src/validator/regression_slope_validator';
9+
export {ConsoleReporter} from './src/reporter/console_reporter';
10+
export {JsonFileReporter} from './src/reporter/json_file_reporter';
11+
export {SampleDescription} from './src/sample_description';
12+
export {PerflogMetric} from './src/metric/perflog_metric';
13+
export {ChromeDriverExtension} from './src/webdriver/chrome_driver_extension';
14+
export {IOsDriverExtension} from './src/webdriver/ios_driver_extension';
15+
export {Runner} from './src/runner';
16+
export {Options} from './src/common_options';
17+
export {MeasureValues} from './src/measure_values';
18+
export {MultiMetric} from './src/metric/multi_metric';
19+
export {MultiReporter} from './src/reporter/multi_reporter';
20+
21+
export {bind, Injector, OpaqueToken} from 'angular2/di';

modules/benchpress/index.cjs

Lines changed: 0 additions & 2 deletions
This file was deleted.

modules/benchpress/src/common_options.js renamed to modules/benchpress/src/common_options.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { bind, OpaqueToken } from 'angular2/di';
2-
import { DateWrapper } from 'angular2/src/facade/lang';
1+
import {bind, OpaqueToken} from 'angular2/di';
2+
import {DateWrapper} from 'angular2/src/facade/lang';
33

44
export class Options {
55
static get DEFAULT_BINDINGS() { return _DEFAULT_BINDINGS; }
@@ -40,10 +40,11 @@ var _NOW = new OpaqueToken('Options.now');
4040
var _WRITE_FILE = new OpaqueToken('Options.writeFile');
4141

4242
var _DEFAULT_BINDINGS = [
43-
bind(_DEFAULT_DESCRIPTION).toValue({}),
43+
bind(_DEFAULT_DESCRIPTION)
44+
.toValue({}),
4445
bind(_SAMPLE_DESCRIPTION).toValue({}),
4546
bind(_FORCE_GC).toValue(false),
4647
bind(_PREPARE).toValue(false),
4748
bind(_MICRO_METRICS).toValue({}),
48-
bind(_NOW).toValue( () => DateWrapper.now() )
49-
];
49+
bind(_NOW).toValue(() => DateWrapper.now())
50+
];
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
library benchpress.src.firefox_extension.data.installed_script;
2+
//no dart implementation

modules/benchpress/src/firefox_extension/data/installed_script.es6

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
declare var exportFunction;
2+
declare var unsafeWindow;
3+
4+
exportFunction(function() { (<any>self).port.emit('startProfiler'); }, unsafeWindow,
5+
{defineAs: "startProfiler"});
6+
7+
exportFunction(function(filePath) { (<any>self).port.emit('stopAndRecord', filePath); },
8+
unsafeWindow, {defineAs: "stopAndRecord"});
9+
10+
exportFunction(function() { (<any>self).port.emit('forceGC'); }, unsafeWindow,
11+
{defineAs: "forceGC"});

0 commit comments

Comments
 (0)