Chore: Set tsconfig target to ES6 (#44842)

* chore(tsconfig): update grafana/tsconfig to 1.2.0 for outputting es6

* rewrote the unsubscription part to use first().

* test: update failing tests to work with es6 output

* removed bug where we dispatch a promise instead of an array of ritch history.

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
This commit is contained in:
Jack Westbrook
2022-02-10 14:37:39 +01:00
committed by GitHub
parent 57ecabf319
commit 979907e9dd
13 changed files with 42 additions and 50 deletions

View File

@@ -1,5 +1,5 @@
import { throwError } from 'rxjs';
import { delay } from 'rxjs/operators';
import { delay, first } from 'rxjs/operators';
import { setDataSourceSrv } from '@grafana/runtime';
import { AlertState, AlertStateInfo } from '@grafana/data';
@@ -60,18 +60,19 @@ function expectOnResults(args: {
expect: (results: DashboardQueryRunnerResult) => void;
}) {
const { runner, done, panelId, expect: expectCallback } = args;
const subscription = runner.getResult(panelId).subscribe({
next: (value) => {
try {
expectCallback(value);
subscription?.unsubscribe();
done();
} catch (err) {
subscription?.unsubscribe();
done.fail(err);
}
},
});
runner
.getResult(panelId)
.pipe(first())
.subscribe({
next: (value) => {
try {
expectCallback(value);
done();
} catch (err) {
done.fail(err);
}
},
});
}
describe('DashboardQueryRunnerImpl', () => {