Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion error on serverless build #31

Open
draxxy9 opened this issue Sep 6, 2020 · 0 comments
Open

Assertion error on serverless build #31

draxxy9 opened this issue Sep 6, 2020 · 0 comments

Comments

@draxxy9
Copy link

draxxy9 commented Sep 6, 2020

Hi, I'm getting an error when trying to build from src-aws.

$ serverless deploy
Serverless: Bundling with Webpack...
Time: 133ms
Built at: 06/09/2020 11:55:04 am
                         Asset      Size  Chunks             Chunk Names
functions/cron-rotate-daily.js  5.63 KiB       0  [emitted]  functions/cron-rotate-daily
Entrypoint functions/cron-rotate-daily = functions/cron-rotate-daily.js
[0] ./core/aws-connections.js 157 bytes {0} [built]
[1] ./core/config.js 177 bytes {0} [built]
[2] ./functions/cron-rotate-daily.js 3.35 KiB {0} [built]
[3] external "aws-sdk" 42 bytes {0} [built]
[4] ./core/helpers.js 4.71 KiB {0} [built]
[5] external "util" 42 bytes {0} [built]
[6] external "zlib" 42 bytes {0} [built]
[7] ./core/helpers/CalculateKwh.js 961 bytes {0} [built]
[8] ./core/helpers/IsNightTarif.js 492 bytes {0} [built]
Time: 121ms
Built at: 06/09/2020 11:55:04 am
                       Asset      Size  Chunks             Chunk Names
functions/graphql/graphql.js  8.56 KiB       0  [emitted]  functions/graphql/graphql
Entrypoint functions/graphql/graphql = functions/graphql/graphql.js
 [0] ./core/config.js 177 bytes {0} [built]
 [1] ./core/aws-connections.js 157 bytes {0} [built]
 [2] ./core/helpers.js 4.71 KiB {0} [built]
 [3] ./functions/graphql/graphql.js 1.25 KiB {0} [built]
 [4] external "graphql/index" 42 bytes {0} [built]
 [5] ./functions/graphql/resolvers/realtime.js 967 bytes {0} [built]
 [6] external "aws-sdk" 42 bytes {0} [built]
 [7] external "util" 42 bytes {0} [built]
 [8] external "zlib" 42 bytes {0} [built]
 [9] ./functions/graphql/resolvers/usageData.js 543 bytes {0} [built]
[10] ./functions/graphql/resolvers/stats.js 1.38 KiB {0} [built]
[11] ./node_modules/graphql-fields/build/index.js 4.98 KiB {0} [built]
[12] ./core/helpers/CalculateKwh.js 961 bytes {0} [built]
[13] ./core/helpers/IsNightTarif.js 492 bytes {0} [built]
[14] external "jStat" 42 bytes {0} [built]
Serverless: Package lock found - Using locked versions
Serverless: Packing external modules: graphql@^14.7.0, jStat@^1.8.6
Running command: npm run test

> src-aws@1.0.0 test /Users/home/home-energy-monitor
> mocha "tests" "./core/helpers/*.test.js"

Warning: Cannot find any files matching pattern "tests"


  Calculate kWh
    1) should return 1 when consuming 1000W for 1 hour
    2) should return 0.5 when consuming 1000W for 30min

  IsNightTarif
    3) should return true for night hours
    4) should return false for day hours
    ✓ should return true for weekends
    ✓ should also work when we pass integers instead of date objects


  2 passing (7ms)
  4 failing

  1) Calculate kWh
       should return 1 when consuming 1000W for 1 hour:

      AssertionError [ERR_ASSERTION]: 0 == 1
      + expected - actual

      -0
      +1
      
      at Context.<anonymous> (core/helpers/CalculateKwh.test.js:14:15)
      at processImmediate (internal/timers.js:461:21)

  2) Calculate kWh
       should return 0.5 when consuming 1000W for 30min:

      AssertionError [ERR_ASSERTION]: 0 == 0.5
      + expected - actual

      -0
      +0.5
      
      at Context.<anonymous> (core/helpers/CalculateKwh.test.js:26:15)
      at processImmediate (internal/timers.js:461:21)

  3) IsNightTarif
       should return true for night hours:

      AssertionError [ERR_ASSERTION]: false == true
      + expected - actual

      -false
      +true
      
      at Context.<anonymous> (core/helpers/IsNightTarif.test.js:8:15)
      at processImmediate (internal/timers.js:461:21)

  4) IsNightTarif
       should return false for day hours:

      AssertionError [ERR_ASSERTION]: true == false
      + expected - actual

      -true
      +false
      
      at Context.<anonymous> (core/helpers/IsNightTarif.test.js:13:16)
      at processImmediate (internal/timers.js:461:21)



npm ERR! code ELIFECYCLE
npm ERR! errno 4
npm ERR! src-aws@1.0.0 test: `mocha "tests" "./core/helpers/*.test.js"`
npm ERR! Exit status 4
npm ERR! 
npm ERR! Failed at the src-aws@1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/home/.npm/_logs/2020-09-06T02_25_13_084Z-debug.log
 
  Error --------------------------------------------------
 
  Error: Command failed: npm run test
      at checkExecSyncError (child_process.js:616:11)
      at execSync (child_process.js:652:15)
      at Scriptable.runCommand (/Users/home/home-energy-monitor/node_modules/serverless-scriptable-plugin/index.js:48:12)
      at /Users/home/home-energy-monitor/node_modules/serverless-scriptable-plugin/index.js:41:21
      at tryCatcher (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/util.js:16:23)
      at Object.gotValue (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/reduce.js:166:18)
      at Object.gotAccum (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/reduce.js:155:25)
      at Object.tryCatcher (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromiseCtx (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/promise.js:641:10)
      at _drainQueueStep (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/Users/home/home-energy-monitor/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (internal/timers.js:461:21)
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              14.9.0
     Framework Version:         1.82.0
     Plugin Version:            3.8.3
     SDK Version:               2.3.1
     Components Version:        2.34.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant