It's probably that the configuration in your project is not finished at all, I followed the quickstart for firebase functions, deployed to my project and then installed the dependencies using:
npm install jest @types/jest firebase-functions-test ts-jest -D
Added the test script to my package.json
"test": "jest --watchAll --verbose=false"
and finally configured jest (jest.config.js) in my project (at my functions directory)
// this config includes typescript specific settings
// and if you're not using typescript, you should remove `transform` property
module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: 'src(/testing/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
testPathIgnorePatterns: ['lib/', 'node_modules/'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testEnvironment: 'node',
rootDir: 'src',
}
After all of this, I created a testing directory inside function/src folder and wrote a simple test like this inside testing
test("should pass", () => {
// test test lol
expect(1).toBe(1);
});
Finally, you can take a look at my package.json file if you have any other doubts about the dependencies I used.
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log",
"test": "jest --watchAll --verbose=false"
},
"engines": {
"node": "8"
},
"main": "lib/index.js",
"dependencies": {
"firebase-admin": "^8.6.0",
"firebase-functions": "^3.3.0"
},
"devDependencies": {
"@types/jest": "^24.0.19",
"firebase-functions-test": "^0.1.6",
"jest": "^24.9.0",
"ts-jest": "^24.1.0",
"tslint": "^5.12.0",
"typescript": "^3.2.2"
},
"private": true
}