test.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. NODE_ENV='test'
  2. MOCHA='npx mocha'
  3. trap "exit" INT
  4. set -e
  5. npm run build
  6. #### Unit tests
  7. $MOCHA ./test/autoExit.spec.ts
  8. $MOCHA ./test/api.spec.ts
  9. $MOCHA ./test/metrics/http.spec.ts
  10. $MOCHA ./test/metrics/runtime.spec.ts
  11. $MOCHA ./test/entrypoint.spec.ts
  12. # $MOCHA ./test/standalone/tracing.spec.ts
  13. # $MOCHA ./test/standalone/events.spec.ts
  14. $MOCHA ./test/features/events.spec.ts
  15. $MOCHA ./test/features/tracing.spec.ts
  16. $MOCHA ./test/metrics/eventloop.spec.ts
  17. $MOCHA ./test/metrics/network.spec.ts
  18. $MOCHA ./test/metrics/v8.spec.ts
  19. $MOCHA ./test/services/actions.spec.ts
  20. $MOCHA ./test/services/metrics.spec.ts
  21. #### Tracing tests
  22. # Enable tests
  23. export OPENCENSUS_MONGODB_TESTS="1"
  24. export OPENCENSUS_REDIS_TESTS="1"
  25. export OPENCENSUS_MYSQL_TESTS="1"
  26. export OPENCENSUS_PG_TESTS="1"
  27. if [ -z "$DRONE" ]
  28. then
  29. export OPENCENSUS_REDIS_HOST="localhost"
  30. export OPENCENSUS_MONGODB_HOST="localhost"
  31. export OPENCENSUS_MYSQL_HOST="localhost"
  32. export OPENCENSUS_PG_HOST="localhost"
  33. else
  34. export OPENCENSUS_REDIS_HOST="redis"
  35. export OPENCENSUS_MONGODB_HOST="mongodb"
  36. export OPENCENSUS_MYSQL_HOST="mysql"
  37. export OPENCENSUS_PG_HOST="postgres"
  38. fi
  39. $MOCHA src/census/plugins/__tests__/http.spec.ts
  40. $MOCHA src/census/plugins/__tests__/http2.spec.ts
  41. $MOCHA src/census/plugins/__tests__/https.spec.ts
  42. $MOCHA src/census/plugins/__tests__/mongodb.spec.ts
  43. $MOCHA src/census/plugins/__tests__/mysql.spec.ts
  44. $MOCHA src/census/plugins/__tests__/mysql2.spec.ts
  45. $MOCHA src/census/plugins/__tests__/ioredis.spec.ts
  46. $MOCHA src/census/plugins/__tests__/vue.spec.ts
  47. $MOCHA src/census/plugins/__tests__/express.spec.ts
  48. $MOCHA src/census/plugins/__tests__/net.spec.ts
  49. $MOCHA src/census/plugins/__tests__/redis.spec.ts
  50. SUPV14=`node -e "require('semver').gte(process.versions.node, '14.0.0') ? console.log('>=14') : console.log('>6')"`
  51. if [ $SUPV14 == '>=14' ]; then
  52. exit
  53. fi
  54. $MOCHA src/census/plugins/__tests__/pg.spec.ts
  55. #$MOCHA ./test/features/profiling.spec.ts