(callback)
| 25 | }); |
| 26 | |
| 27 | function setupModels(callback) { |
| 28 | const config = self.sequelize.config; |
| 29 | const autoBin = path.join(__dirname, '..', 'bin', 'sequelize-auto'); |
| 30 | try { |
| 31 | let execString = `node ${autoBin} -o "${testConfig.directory}" -d ${config.database} -h ${config.host}`; |
| 32 | if (_.has(config, 'username') && !_.isNull(config.username)) { |
| 33 | execString += ` -u ${config.username}`; |
| 34 | } |
| 35 | if (_.has(config, 'password') && config.password != null) { |
| 36 | execString += ` -x ${config.password}`; |
| 37 | } |
| 38 | if (_.has(config, 'port') && !_.isNull(config.port)) { |
| 39 | execString += ` -p ${config.port}`; |
| 40 | } |
| 41 | if (_.isString(self.sequelize.options.dialect)) { |
| 42 | execString += ` -e ${self.sequelize.options.dialect}`; |
| 43 | } |
| 44 | if (helpers.views) { |
| 45 | execString += ' -v'; // test view generation |
| 46 | } |
| 47 | // execString += ' -l es6'; // uncomment to test es6 file generation |
| 48 | if (helpers.isSnakeTables()) { |
| 49 | execString += ' --cm p --cf p'; // test PascalCase conversion from snake_case tables |
| 50 | } |
| 51 | debug('Starting child process:', execString); |
| 52 | exec(execString, callback); |
| 53 | } catch (err) { |
| 54 | callback(err); |
| 55 | } |
| 56 | }; |
| 57 | |
| 58 | describe('should be able to generate', function() { |
| 59 | it('the model files.', function(done) { |
no test coverage detected