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..ba4d08621 --- /dev/null +++ b/mocha/setup.ts @@ -0,0 +1,7 @@ +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 10f0c33d1..76ea87fb5 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,13 @@ }, "license": "MIT", "author": "Firebase Team", - "files": ["lib"], + "files": [ + "lib" + ], "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { + "apidocs": "node docgen/generate-docs.js", "build:pack": "rm -rf lib && npm install && tsc -p tsconfig.release.json && npm pack", "build:release": "npm install --production && npm install typescript firebase-admin && tsc -p tsconfig.release.json", "build": "tsc -p tsconfig.release.json", @@ -29,8 +32,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", - "apidocs": "node docgen/generate-docs.js" + "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 0eb95045d..000000000 --- a/spec/index.spec.ts +++ /dev/null @@ -1,47 +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 './utilities/path.spec'; -import './utils.spec';