Skip to content

Commit

Permalink
feat: add support for test files colocated with models (#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucianolo committed Nov 5, 2022
1 parent 0e2b39d commit 6ba32e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/assets/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ if (config.use_env_variable) {
fs
.readdirSync(__dirname)
.filter(file => {
return (file.indexOf('.') !== 0) && (file !== basename) && (file.slice(-3) === '.js');
return (
file.indexOf('.') !== 0 &&
file !== basename &&
file.slice(-3) === '.js' &&
file.indexOf('.test.js') === -1
);
})
.forEach(file => {
const model = require(path.join(__dirname, file))(sequelize, Sequelize.DataTypes);
Expand Down

0 comments on commit 6ba32e1

Please sign in to comment.