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