sequelize/express-example

run npm test failed

huguangju opened this issue · 0 comments

$NODE_ENV = test
mocha test/integration/*.test.js

  user creation page
Executing (default): TRUNCATE `Tasks`
Executing (default): TRUNCATE `Users`
    1) "before each" hook for "loads correctly"


  0 passing (99ms)
  1 failing

  1) user creation page "before each" hook for "loads correctly":
     SequelizeDatabaseError: ER_TRUNCATE_ILLEGAL_FK: Cannot truncate a table referenced in a foreign key constraint (`database_test`.`tasks`, CONSTRAINT `tasks_ibfk_1` FOREIGN KEY (`UserId`) REFERENCES `database_test`.`Users` (`id`))
      at Query.formatError (node_modules/sequelize/lib/dialects/mysql/query.js:175:14)
      at Query._callback (node_modules/sequelize/lib/dialects/mysql/query.js:49:21)
      at Query.Sequence.end (/Users/hugo/programming/github/_me/node-samples/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
      at Query.ErrorPacket (/Users/hugo/programming/github/_me/node-samples/node_modules/mysql/lib/protocol/sequences/Query.js:94:8)
      at Protocol._parsePacket (/Users/hugo/programming/github/_me/node-samples/node_modules/mysql/lib/protocol/Protocol.js:280:23)
      at Parser.write (/Users/hugo/programming/github/_me/node-samples/node_modules/mysql/lib/protocol/Parser.js:73:12)
      at Protocol.write (/Users/hugo/programming/github/_me/node-samples/node_modules/mysql/lib/protocol/Protocol.js:39:16)
      at Socket.<anonymous> (/Users/hugo/programming/github/_me/node-samples/node_modules/mysql/lib/Connection.js:96:28)
      at readableAddChunk (_stream_readable.js:146:16)
      at Socket.Readable.push (_stream_readable.js:110:10)
      at TCP.onread (net.js:523:20)