micro-analytics / micro-analytics-cli

Public analytics as a Node.js microservice. No sysadmin experience required! 📈
MIT License
734 stars 39 forks source link

Tests throw "ReferenceError: async is not defined" #38

Closed sean-roberts closed 7 years ago

sean-roberts commented 7 years ago

I am pulling my hair out trying to get the aysnc-to-gen stuff going. I am running node 6.2 (and I have jest-cli globally).

ReferenceError: async is not defined

      at Object.<anonymous> (node_modules/micro-analytics-adapter-flat-file-db/index.js:11:8)
      at Object.<anonymous> (src/db.js:9:13)
      at Object.<anonymous> (src/index.js:4:12)
      at Object.<anonymous> (tests/items.test.js:5:17)

for all three tests. Basically, jest isn't applying the transforms but I have no idea why. Do you experience this as well?

mxstbr commented 7 years ago

I've been thinking of getting rid of micro and async in general, to be honest. I heard promises might be significantly slower than callbacks, so I've been meaning to write a proof of concept without Promises...

relekang commented 7 years ago

Might be worth looking into alternative promise implementation for better performance (benchmarks in the bluebird wiki has some info). However, I am not sure that the difference between callbacks and promises will be significant compared to the time needed to store in a database?

@sean-roberts What happens if you install jest-cli locally and run ./node_modules/.bin/jest?

mxstbr commented 7 years ago

That might be worth looking into, eventhough their benchmarks show "callbacks baseline" to be the fastest across the board the difference between bluebird and callbacks isn't super huge!