Skip to content

Commit 1314113

Browse files
committed
support tags
1 parent a29cb0e commit 1314113

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

packages/bson-bench/src/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export type BenchmarkSpecification = {
134134
* local package */
135135
library: string;
136136
installLocation?: string;
137+
tags?: string[];
137138
};
138139

139140
export interface RunBenchmarkMessage {

packages/bson-bench/src/task.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class Task {
2222
benchmark: Omit<BenchmarkSpecification, 'installLocation'> & { installLocation: string };
2323
taskName: string;
2424
testName: string;
25+
tags?: string[];
2526
/** @internal */
2627
children: ChildProcess[];
2728
/** @internal */
@@ -33,6 +34,7 @@ export class Task {
3334
this.result = undefined;
3435
this.children = [];
3536
this.hasRun = false;
37+
this.tags = benchmarkSpec.tags;
3638
this.benchmark = { ...benchmarkSpec, installLocation: Task.packageInstallLocation };
3739

3840
this.taskName = `${path.basename(this.benchmark.documentPath, 'json')}_${
@@ -119,6 +121,7 @@ export class Task {
119121
const perfSendResults: PerfSendResult = {
120122
info: {
121123
test_name: this.testName,
124+
tags: this.tags,
122125
args: {
123126
warmup: this.benchmark.warmup,
124127
iterations: this.benchmark.iterations,

packages/bson-bench/test/unit/suite.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ describe('Suite', function () {
8888
warmup: 10,
8989
iterations: 10,
9090
library: '[email protected]',
91-
options: {}
91+
options: {},
92+
tags: ['test']
9293
};
9394
suite
9495
.task({

packages/bson-bench/test/unit/task.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ describe('Task', function () {
4242
operation,
4343
warmup: 100,
4444
iterations: 100,
45-
options: {}
45+
options: {},
46+
tags: ['test']
4647
}
4748
];
4849
})
@@ -77,6 +78,10 @@ describe('Task', function () {
7778
expect(task.testName).to.not.include(test.library);
7879
expect(task.testName).to.match(/bson|bson-ext/);
7980
});
81+
82+
it('collects the tags correctly', function() {
83+
expect(task.tags).to.deep.equal(['test']);
84+
});
8085
});
8186
}
8287

0 commit comments

Comments
 (0)