angular-fullstack / generator-angular-fullstack

Yeoman generator for an Angular app with an Express server
https://awk34.gitbook.io/generator-angular-fullstack
6.13k stars 1.24k forks source link

Sinon spy spec error #2726

Closed royxue closed 6 years ago

royxue commented 6 years ago
Item Version
generator-angular-fullstack x.x.x
Node 10.1.0
npm 5.6.0
Operating System OS X 10
etc etc
Item Answer
Transpiler Babel
Server Tests Jasmine / Mocha
DB MongoDB / SQL
Auth Y

I tried to run the users/index.spec.js but the sinon spy cannot run correct Here is the error showed in spy:

errorWithCallStack: Error
    at Function.invoke (/node_modules/sinon/lib/sinon/spy.js:224:19)
    at Object.proxy [as delete] (/node_modules/sinon/lib/sinon/spy.js:95:22)
    at Object.<anonymous> (/server/api/users/index.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at loader (/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/node_modules/babel-register/lib/node.js:154:7)
    at Object.require.extensions.(anonymous function) (/node_modules/proxyquire/lib/proxyquire.js:305:43)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Module.require (internal/modules/cjs/loader.js:626:17)
    at Proxyquire._withoutCache (/node_modules/proxyquire/lib/proxyquire.js:215:12)
    at Proxyquire.load (/node_modules/proxyquire/lib/proxyquire.js:129:15)
    at Object.<anonymous> (/server/tests/user.index.test.js:33:17)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at loader (/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Module.require (internal/modules/cjs/loader.js:626:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at /node_modules/mocha/lib/mocha.js:250:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/node_modules/mocha/lib/mocha.js:247:14)
    at Mocha.run (/node_modules/mocha/lib/mocha.js:576:10)
    at Object.<anonymous> (/node_modules/mocha/bin/_mocha:637:18)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
    at startup (internal/bootstrap/node.js:228:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:576:3) },

and here is my babelrc

{
  "presets": ["es2015", "stage-2"],
  "plugins": [
    ["transform-runtime", {
      "polyfill": false,
      "regenerator": true
    }]
  ]
}

How should I fix the tests?

royxue commented 6 years ago

My bad, resolved, close this.