vendredi 29 novembre 2019

"ERROR: Validation error" message when executing two Sequelize commands in "pretest" script

I'm writing tests for my project. It uses Sequelize and I thought about doing the following:

"pretest": "NODE_ENV=testing yarn sequelize db:migrate && yarn sequelize db:seed:all",
"test": "mocha --require @babel/register 'src/tests/**/*.spec.js'",
"posttest": "NODE_ENV=testing yarn sequelize db:migrate:undo:all"

But the following shows:

❯ yarn test     
yarn run v1.19.2
$ NODE_ENV=testing yarn sequelize db:migrate && yarn sequelize db:seed:all
$ /home/gabriel/Workspace/graphql-apollo/node_modules/.bin/sequelize db:migrate

Sequelize CLI [Node: 12.13.1, CLI: 5.5.1, ORM: 5.21.2]

Loaded configuration file "src/config/database.js".
== 20191123132531-create-users: migrating =======
== 20191123132531-create-users: migrated (0.047s)

== 20191123132658-create-messages: migrating =======
== 20191123132658-create-messages: migrated (0.028s)

$ /home/gabriel/Workspace/graphql-apollo/node_modules/.bin/sequelize db:seed:all

Sequelize CLI [Node: 12.13.1, CLI: 5.5.1, ORM: 5.21.2]

Loaded configuration file "src/config/database.js".
== 20191123132945-users: migrating =======

ERROR: Validation error

error Command failed with exit code 1.

If I execute the migration and seeding command separately, it works fine. Why's this ERROR: Validation error happening when having them in one line?

Aucun commentaire:

Enregistrer un commentaire