diff --git a/gulpfile.js b/gulpfile.js index 5e02ceab203dfa11fd6a15d1d0a8f12190c3d05a..19c1100ee295cc7191a42aefd1ae0c7bf788b6eb 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -54,12 +54,13 @@ var concat = require('gulp-concat') var watch = require('gulp-watch') var options = minimist(process.argv.slice(2), { - string: ['export', 'name', 'testport', 'testfiles'], + string: ['export', 'name', 'testport', 'testfiles', 'regenerator'], default: { export: 'ignore', name: 'y.js', testport: '8888', - testfiles: 'src/**/*.js' + testfiles: 'src/**/*.js', + regenerator: process.version < 'v0.12' } }) @@ -92,6 +93,10 @@ var files = { }).concat(['build/**/*.spec.js'])) } +if (options.regenerator) { + files.test = polyfills.concat(files.test) +} + gulp.task('build:deploy', function () { gulp.src(files.src) .pipe(sourcemaps.init()) @@ -107,14 +112,17 @@ gulp.task('build:deploy', function () { }) gulp.task('build:test', function () { + var babelOptions = { + loose: 'all', + modules: 'ignore', + experimental: true + } + if (!options.regenerator) { + babelOptions.blacklist = 'regenerator' + } gulp.src('src/**/*.js') .pipe(sourcemaps.init()) - .pipe(babel({ - loose: 'all', - modules: 'ignore', - blacklist: 'regenerator', - experimental: true - })) + .pipe(babel(babelOptions)) .pipe(sourcemaps.write()) .pipe(gulp.dest('build')) }) @@ -138,7 +146,11 @@ gulp.task('dev', ['build:test'], function () { }) gulp.task('test', ['build:test'], function () { - return gulp.src(files.test) + var testfiles = files.test + if (typeof Promise === 'undefined') { + testfiles = ['./node_modules/promise-polyfill/Promise.js'].concat(testfiles) + } + return gulp.src(testfiles) .pipe(jasmine({ verbose: true, includeStuckTrace: true diff --git a/package.json b/package.json index 2f95ffb87eeb381e69fa27477fdbebbb1ccc368a..291dca7c307cd4f870672748a33a9566d712e467 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "gulp-watch": "^4.3.5", "minimist": "^1.2.0", "pre-commit": "^1.1.1", + "promise-polyfill": "^2.1.0", "standard": "^5.2.2" } } diff --git a/src/OperationStore.js b/src/OperationStore.js index 37031f6acd9adae5b6195e461433de3d23bdb770..8ddf4375f6b0120b762ad193ba426992b5c2aa9a 100644 --- a/src/OperationStore.js +++ b/src/OperationStore.js @@ -298,7 +298,7 @@ class AbstractOperationStore { op.deleted === true && this.y.connector.isSynced && left != null && - left.deleted && + left.deleted ) { op.gc = true this.gc1.push(op.id)