Easiest way to import MySQL database in nodejs for integration testing

I have an web app built with nodejs and I want to do some integration testing of my API that will involve hitting a live database.

Is there any easy way to load & execute an SQL dump file to pre-populate the database before running my tests?

You could group your sql queries for restoring your databases in any teardown or tearup events when needed.

you might want to use any kind of flag before running your tests that needs a clean "data structure"

To load the dump, in a terminal:

mysql -u youruser -p yourdatabasename < /path/to/your/dump_file.sql

type in the password.

If you want to create the dump, in a terminal:

mysqldump -u youruser -p yourdatabasename > /path/to/your/dump_file.sql