From db9bec595ea2d6c59b611f52edf4ca8ad80e3be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Wed, 10 Jul 2019 23:04:21 +0200 Subject: [PATCH 1/3] Introduce mocha configuration file --- .mocharc.yaml | 10 ++++++++++ mocha/setup.ts | 8 ++++++++ package.json | 2 +- spec/index.spec.ts | 46 ------------------------------------------- spec/support/setup.ts | 0 5 files changed, 19 insertions(+), 47 deletions(-) create mode 100644 .mocharc.yaml create mode 100644 mocha/setup.ts delete mode 100644 spec/index.spec.ts create mode 100644 spec/support/setup.ts diff --git a/.mocharc.yaml b/.mocharc.yaml new file mode 100644 index 000000000..932144124 --- /dev/null +++ b/.mocharc.yaml @@ -0,0 +1,10 @@ +exit: true +extension: + - ts +file: + - mocha/setup.ts +package: ./package.json +reporter: spec +require: + - 'ts-node/register' +spec: spec/**/*.spec.ts diff --git a/mocha/setup.ts b/mocha/setup.ts new file mode 100644 index 000000000..6e5c13308 --- /dev/null +++ b/mocha/setup.ts @@ -0,0 +1,8 @@ +import * as chai from 'chai'; +import * as chaiAsPromised from 'chai-as-promised'; +import * as nock from 'nock'; + +chai.use(chaiAsPromised); + +nock.disableNetConnect(); + diff --git a/package.json b/package.json index 916c4159f..55de16c9f 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "format:fix": "prettier --write '**/*.{json,md,ts,yml,yaml}'", "lint": "tslint --config tslint.json --project tsconfig.json ", "lint:fix": "tslint --config tslint.json --fix --project tsconfig.json", - "test": "mocha -r ts-node/register ./spec/index.spec.ts" + "test": "mocha" }, "dependencies": { "@types/express": "^4.17.0", diff --git a/spec/index.spec.ts b/spec/index.spec.ts deleted file mode 100644 index 64ffdf62e..000000000 --- a/spec/index.spec.ts +++ /dev/null @@ -1,46 +0,0 @@ -// The MIT License (MIT) -// -// Copyright (c) 2017 Firebase -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -import * as chai from 'chai'; -import * as chaiAsPromised from 'chai-as-promised'; -chai.use(chaiAsPromised); - -import * as nock from 'nock'; -nock.disableNetConnect(); - -import 'mocha'; - -import './apps.spec'; -import './cloud-functions.spec'; -import './config.spec'; -import './function-builder.spec'; -import './providers/analytics.spec'; -import './providers/auth.spec'; -import './providers/crashlytics.spec'; -import './providers/database.spec'; -import './providers/firestore.spec'; -import './providers/https.spec'; -import './providers/pubsub.spec'; -import './providers/remoteConfig.spec'; -import './providers/storage.spec'; -import './setup.spec'; -import './utils.spec'; diff --git a/spec/support/setup.ts b/spec/support/setup.ts new file mode 100644 index 000000000..e69de29bb From 262fce440c185816455b2b1ade19fd513191cb25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Wed, 10 Jul 2019 23:22:49 +0200 Subject: [PATCH 2/3] Reformat --- mocha/setup.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/mocha/setup.ts b/mocha/setup.ts index 6e5c13308..ba4d08621 100644 --- a/mocha/setup.ts +++ b/mocha/setup.ts @@ -5,4 +5,3 @@ import * as nock from 'nock'; chai.use(chaiAsPromised); nock.disableNetConnect(); - From 90b29a916a743f5b9d43fec52ace4f5e06c49424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Fri, 12 Jul 2019 00:28:14 +0200 Subject: [PATCH 3/3] Remove an empty file --- spec/support/setup.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 spec/support/setup.ts diff --git a/spec/support/setup.ts b/spec/support/setup.ts deleted file mode 100644 index e69de29bb..000000000