diff --git a/README.md b/README.md index 60c02598659..f6495db98a6 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,18 @@ gulp --tasks ## Testing the SDK -To run all tests for the SDK simply run: `npm test` at the root of this package. +To run all tests for the SDK you must first supply a firebase project config for +your tests. This is done by creating a file called `project.json` and at the +following path: + +``` +tests/config/project.json +``` + +This file should contain a JSON object with your app information (i.e. the same +information you would pass to `firebase.initializeApp`). + +After you have done this, simply run: `npm test` at the root of this package. There are several types of available tests: diff --git a/package.json b/package.json index 1c936adca3f..b3a9d46a3c7 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "karma-firefox-launcher": "^1.0.1", "karma-mocha": "^1.3.0", "karma-spec-reporter": "^0.0.30", - "karma-typescript": "^3.0.1", + "karma-typescript": "^3.0.4", "merge2": "^1.0.3", "mkdirp": "^0.5.1", "require-dir": "^0.3.1", @@ -76,8 +76,8 @@ "shx": "^0.2.2", "sinon": "^2.1.0", "through2": "^2.0.3", - "ts-node": "2.1.1", - "typescript": "^2.2.1", + "ts-node": "^3.3.0", + "typescript": "^2.4.2", "validate-commit-msg": "^2.12.1", "vinyl-named": "^1.1.0", "webpack": "^3.0.0", diff --git a/src/messaging/controllers/window-controller.ts b/src/messaging/controllers/window-controller.ts index 9023065e4d3..fa2721ebb8c 100644 --- a/src/messaging/controllers/window-controller.ts +++ b/src/messaging/controllers/window-controller.ts @@ -247,7 +247,7 @@ export default class WindowController extends ControllerInterface { const serviceWorker = registration.installing || registration.waiting || registration.active; - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { if (!serviceWorker) { // This is a rare scenario but has occured in firefox reject(this.errorFactory_.create(Errors.codes.NO_SW_IN_REG)); diff --git a/src/messaging/models/db-interface.ts b/src/messaging/models/db-interface.ts index 9832eebb635..58044514393 100644 --- a/src/messaging/models/db-interface.ts +++ b/src/messaging/models/db-interface.ts @@ -25,7 +25,7 @@ export default class DBInterface { private dbVersion_: number; private openDbPromise_: Promise; protected errorFactory_: ErrorFactory; - protected TRANSACTION_READ_WRITE: string; + protected TRANSACTION_READ_WRITE: IDBTransactionMode; /** * @param {string} dbName diff --git a/src/storage/task.ts b/src/storage/task.ts index 6ea29692a32..2d084acb485 100644 --- a/src/storage/task.ts +++ b/src/storage/task.ts @@ -493,13 +493,15 @@ export class UploadTask { /** * This object behaves like a Promise, and resolves with its snapshot data * when the upload completes. - * The fulfillment callback. Promise chaining works as normal. + * @param onFulfilled The fulfillment callback. Promise chaining works as normal. * @param onRejected The rejection callback. */ then(onFulfilled?: ((value: UploadTaskSnapshot) => U | PromiseLike) | null, onRejected?: ((error: any) => U | PromiseLike) | null): Promise { + // These casts are needed so that TypeScript can infer the types of the + // resulting Promise. return this.promise_.then( (onFulfilled as (value: UploadTaskSnapshot) => U | PromiseLike), - (onRejected as ((error: any) => PromiseLike) | null)); + (onRejected as ((error: any) => PromiseLike) | null)); } /** diff --git a/yarn.lock b/yarn.lock index d501fd7c7eb..d163cbfe3e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -152,6 +152,12 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" + dependencies: + color-convert "^1.9.0" + anymatch@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507" @@ -1335,6 +1341,14 @@ chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.0.1.tgz#dbec49436d2ae15f536114e76d14656cdbc0f44d" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + child-process-promise@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/child-process-promise/-/child-process-promise-2.2.1.tgz#4730a11ef610fad450b8f223c79d31d7bdad8074" @@ -1453,6 +1467,16 @@ collection-visit@^0.2.1: map-visit "^0.1.5" object-visit "^0.3.4" +color-convert@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" + dependencies: + color-name "^1.1.1" + +color-name@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + colors@1.0.x: version "1.0.3" resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" @@ -3119,6 +3143,10 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + has-gulplog@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce" @@ -3774,9 +3802,9 @@ karma-spec-reporter@^0.0.30: dependencies: colors "^1.1.2" -karma-typescript@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/karma-typescript/-/karma-typescript-3.0.1.tgz#64619473a68973773ec3132f96be06da7428427e" +karma-typescript@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/karma-typescript/-/karma-typescript-3.0.4.tgz#9cdeeeddd1671693440c34ec62aba2d6ff9e4b05" dependencies: acorn "^4.0.4" amdefine "1.0.0" @@ -5066,7 +5094,7 @@ pinkie-promise@^2.0.0: dependencies: pinkie "^2.0.0" -pinkie@^2.0.0, pinkie@^2.0.4: +pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" @@ -5998,6 +6026,12 @@ supports-color@^3.1.0: dependencies: has-flag "^1.0.0" +supports-color@^4.0.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836" + dependencies: + has-flag "^2.0.0" + symbol-tree@^3.2.1: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" @@ -6222,22 +6256,20 @@ trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" -ts-node@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-2.1.1.tgz#2fe7049ea56319730052a9e677985e6151a7bd31" +ts-node@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-3.3.0.tgz#c13c6a3024e30be1180dd53038fc209289d4bf69" dependencies: arrify "^1.0.0" - chalk "^1.1.1" + chalk "^2.0.0" diff "^3.1.0" make-error "^1.1.1" minimist "^1.2.0" mkdirp "^0.5.1" - pinkie "^2.0.4" source-map-support "^0.4.0" tsconfig "^6.0.0" - v8flags "^2.0.11" - xtend "^4.0.0" - yn "^1.2.0" + v8flags "^3.0.0" + yn "^2.0.0" tsconfig@^6.0.0: version "6.0.0" @@ -6289,9 +6321,9 @@ typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript@^2.2.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.2.tgz#f0f045e196f69a72f06b25fd3bd39d01c3ce9984" +typescript@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.4.2.tgz#f8395f85d459276067c988aa41837a8f82870844" uglify-js@^2.6, uglify-js@^2.8.29: version "2.8.29" @@ -6460,12 +6492,18 @@ uuid@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" -v8flags@^2.0.10, v8flags@^2.0.11, v8flags@^2.0.9: +v8flags@^2.0.10, v8flags@^2.0.9: version "2.1.1" resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4" dependencies: user-home "^1.1.1" +v8flags@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.0.tgz#4be9604488e0c4123645def705b1848d16b8e01f" + dependencies: + user-home "^1.1.1" + vali-date@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/vali-date/-/vali-date-1.0.0.tgz#1b904a59609fb328ef078138420934f6b86709a6" @@ -6873,6 +6911,6 @@ yeast@0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419" -yn@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/yn/-/yn-1.2.0.tgz#d237a4c533f279b2b89d3acac2db4b8c795e4a63" +yn@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a"