Skip to content

Commit

Permalink
Fix TypeScript execution
Browse files Browse the repository at this point in the history
  • Loading branch information
papb committed Jan 23, 2021
1 parent 153cfd2 commit 0c178a1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions setup/global-adjusts.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ process.on("unhandledRejection", e => {
throw e;
});

const sequelizeVersion = require('sequelize/package.json').version;
const sequelizeVersion = require('./sequelize-version');

if (/^v?5/.test(sequelizeVersion)) {
if (sequelizeVersion.startsWith('v5')) {
Sequelize.Promise.onPossiblyUnhandledRejection(e => {
console.error('An unhandled rejection occurred:');
throw e;
Expand Down
26 changes: 14 additions & 12 deletions setup/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@

require('./global-adjusts');

const sequelizeVersion = require('./sequelize-version');

const USE_TS = process.env.CI_COMBINATION === 'v6 with TS';

async function run() {
console.log('\n' + '-'.repeat(30) + '\n');
let heading = `Running SSCCE for ${process.env.DIALECT.toUpperCase()} with Sequelize ${sequelizeVersion}`;
if (USE_TS) heading += ' with TypeScript';
heading = `===== ${heading} =====`;

console.blue('\n' + '-'.repeat(heading.length));
console.blue(heading);
console.blue('-'.repeat(heading.length) + '\n');

if (process.env.LOCAL_SSCCE) {
console.gold('Warning: running the SSCCE locally will use SQLite only. To run your SSCCE in all dialects, just configure Travis CI / AppVeyor in your GitHub repository.\n');
}

if (process.env.USE_TS) {
console.blue(`===== Running SSCCE for ${process.env.DIALECT.toUpperCase()} with TypeScript =====`);
} else {
console.blue(`===== Running SSCCE for ${process.env.DIALECT.toUpperCase()} =====`);
}

console.log('\n' + '-'.repeat(30) + '\n');

if (process.env.USE_TS) {
if (USE_TS) {
const { run } = require('./../ts-dist/sscce'); // eslint-disable-line
await run();
} else {
Expand All @@ -28,11 +30,11 @@ async function run() {
(async () => {
try {
await run();
console.log('\n' + '-'.repeat(30) + '\n');
console.log('\n' + '-'.repeat(40) + '\n');
console.green('SSCCE done without errors!');
} catch (e) {
console.red(e);
console.log('\n' + '-'.repeat(30) + '\n');
console.log('\n' + '-'.repeat(40) + '\n');
console.red('SSCCE done with error (see above).');
process.exit(1); // eslint-disable-line no-process-exit
}
Expand Down
1 change: 1 addition & 0 deletions setup/sequelize-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('sequelize/package.json').version.replace(/^v?/, 'v');

0 comments on commit 0c178a1

Please sign in to comment.