firebase / firebase-functions-test

MIT License
232 stars 48 forks source link

Compiler error after update to v2.0.0 #136

Closed JarnoRFB closed 2 years ago

JarnoRFB commented 2 years ago

Version info

firebase-functions-test: 2.0.0

firebase-functions: 3.20.1

firebase-admin: 10.1.0

Test case

import firebaseFunctionTest from "firebase-functions-test";

const projectId = "demo-afc";
const test = firebaseFunctionTest({
  projectId,
  storageBucket: "test",
  databaseURL: "http://localhost:9000/?ns=demo-afc",
});
    "test:unit": "mocha -r ts-node/register --timeout 10000 --exit src/**/*.test.ts $npm_config_mocha_opts",
    "test": "tsc && npx firebase -P demo-afc emulators:exec --only firestore,database,auth,storage \"npm run test:unit\"",

Steps to reproduce

Run npm run test

Expected behavior

The program compiles and executes the tests.

Actual behavior

node_modules/firebase-functions-test/lib/main.d.ts:5:138 - error TS2305: Module '"./v1"' has no exported member '_makeResourceName'.

5 export { ContextOptions, EventContextOptions, WrappedFunction, WrappedScheduledFunction, CallableContextOptions, makeChange, mockConfig, _makeResourceName, _extractParams, } from './v1';
                                                                                                                                           ~~~~~~~~~~~~~~~~~

node_modules/firebase-functions-test/lib/main.d.ts:5:157 - error TS2305: Module '"./v1"' has no exported member '_extractParams'.

5 export { ContextOptions, EventContextOptions, WrappedFunction, WrappedScheduledFunction, CallableContextOptions, makeChange, mockConfig, _makeResourceName, _extractParams, } from './v1';

The typescript compiler fails due to a type error. I can see that _extractParams and _makeResourceName are exported in v1.js, but are missing from the exports in v1.d.ts.

tylim88 commented 2 years ago

issue still persists in v2.0.2

revert back to 0.3.3

TheIronDev commented 2 years ago

Thank you for catching this! I have a fix coming right up in a jiffy!

gugahoi commented 2 years ago

Will there be a new release to fix this?

TheIronDev commented 2 years ago

Will there be a new release to fix this?

Yep, I'll be publishing a patch tomorrow morning.

I'll ping this thread after the patch gets released.

TheIronDev commented 2 years ago

Patch has been published. I'm going to continue testing on my end, but please feel free to file another issue or ping me if things aren't working right for you!

JarnoRFB commented 2 years ago

@TheIronDev works for me in v2.0.2 :+1: Still had to adapt some typings, due to the updated typings in general, but those were unrelated to the original error. Maybe that is what @tylim88 experiences as well.

TheIronDev commented 2 years ago

@tylim88 tylim88 Pleaes let me know if the issue still persists. v2.0.2 wasn't published when you had replied.

tylim88 commented 2 years ago

@TheIronDev that was a typo, it was 2.0.1

2.0.2 is fine now

TheIronDev commented 2 years ago

Awesome, happy to hear that!