Commit 8370a182 by Johannes Schill Committed by Torkel Ödegaard

Tech: Bump typescript and jest (#16354)

* chore: Bump Typescript to 3.4.1

* chore: Bump babel-jest, jest, ts-jest

* fix: Fix tests after typescript upgrade by disabling some typings

* chore: noImplicitAny

* chore: Bump typescript in @grafana/ui
parent 85b4b336
......@@ -40,7 +40,7 @@
"autoprefixer": "^9.4.10",
"axios": "^0.18.0",
"babel-core": "^7.0.0-bridge",
"babel-jest": "^24.5.0",
"babel-jest": "^24.6.0",
"babel-loader": "^8.0.4",
"babel-plugin-angularjs-annotate": "^0.10.0",
"chalk": "^2.4.2",
......@@ -77,7 +77,7 @@
"html-webpack-plugin": "^3.2.0",
"husky": "^1.3.1",
"inquirer": "^6.2.2",
"jest": "^24.5.0",
"jest": "^24.6.0",
"jest-date-mock": "^1.0.6",
"lint-staged": "^8.1.3",
"load-grunt-tasks": "3.5.2",
......@@ -110,14 +110,14 @@
"systemjs": "0.20.19",
"systemjs-plugin-css": "^0.1.36",
"terser-webpack-plugin": "^1.2.3",
"ts-jest": "^24.0.0",
"ts-jest": "^24.0.1",
"ts-loader": "5.3.3",
"ts-node": "8.0.2",
"tslib": "1.9.3",
"tslint": "5.14.0",
"tslint-loader": "^3.5.3",
"tslint-react": "^3.6.0",
"typescript": "3.3.3333",
"typescript": "3.4.1",
"webpack": "4.29.6",
"webpack-bundle-analyzer": "3.1.0",
"webpack-cleanup-plugin": "^0.5.1",
......
......@@ -76,7 +76,7 @@
"rollup-plugin-terser": "^4.0.4",
"rollup-plugin-typescript2": "^0.19.2",
"rollup-plugin-visualizer": "^0.9.2",
"typescript": "^3.2.2"
"typescript": "3.4.1"
},
"resolutions": {
"@types/lodash": "4.14.119"
......
......@@ -2,7 +2,7 @@ import store from '../store';
Object.assign(window, {
localStorage: {
removeItem(key) {
removeItem(key: string) {
delete window.localStorage[key];
},
},
......
type StoreValue = string | number | boolean | null;
export class Store {
get(key) {
get(key: string) {
return window.localStorage[key];
}
set(key, value) {
set(key: string, value: StoreValue) {
window.localStorage[key] = value;
}
getBool(key, def) {
getBool(key: string, def: any) {
if (def !== void 0 && !this.exists(key)) {
return def;
}
......@@ -46,11 +48,11 @@ export class Store {
return true;
}
exists(key) {
exists(key: string) {
return window.localStorage[key] !== void 0;
}
delete(key) {
delete(key: string) {
window.localStorage.removeItem(key);
}
}
......
......@@ -945,6 +945,7 @@ describe('PrometheusDatasource', () => {
expect(res.method).toBe('GET');
expect(res.url).toBe(urlExpected);
// @ts-ignore
expect(templateSrv.replace.mock.calls[0][1]).toEqual({
__interval: {
text: '10s',
......@@ -984,6 +985,7 @@ describe('PrometheusDatasource', () => {
expect(res.method).toBe('GET');
expect(res.url).toBe(urlExpected);
// @ts-ignore
expect(templateSrv.replace.mock.calls[0][1]).toEqual({
__interval: {
text: '5s',
......@@ -1024,6 +1026,7 @@ describe('PrometheusDatasource', () => {
expect(res.method).toBe('GET');
expect(res.url).toBe(urlExpected);
// @ts-ignore
expect(templateSrv.replace.mock.calls[0][1]).toEqual({
__interval: {
text: '10s',
......@@ -1070,6 +1073,7 @@ describe('PrometheusDatasource', () => {
expect(res.method).toBe('GET');
expect(res.url).toBe(urlExpected);
// @ts-ignore
expect(templateSrv.replace.mock.calls[0][1]).toEqual({
__interval: {
text: '5s',
......@@ -1110,6 +1114,7 @@ describe('PrometheusDatasource', () => {
expect(res.method).toBe('GET');
expect(res.url).toBe(urlExpected);
// @ts-ignore
expect(templateSrv.replace.mock.calls[0][1]).toEqual({
__interval: {
text: '5s',
......@@ -1155,6 +1160,7 @@ describe('PrometheusDatasource', () => {
expect(res.method).toBe('GET');
expect(res.url).toBe(urlExpected);
// @ts-ignore
expect(templateSrv.replace.mock.calls[0][1]).toEqual({
__interval: {
text: '5s',
......
......@@ -24,16 +24,16 @@ global.$ = global.jQuery = $;
const localStorageMock = (() => {
let store = {};
return {
getItem: key => {
getItem: (key: string) => {
return store[key];
},
setItem: (key, value) => {
setItem: (key: string, value) => {
store[key] = value.toString();
},
clear: () => {
store = {};
},
removeItem: key => {
removeItem: (key: string) => {
delete store[key];
},
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment