From cb2dcda46863f24bbac74e196be2eeb0fae11311 Mon Sep 17 00:00:00 2001 From: Sam Saccone Date: Sun, 3 Dec 2017 10:42:15 -0800 Subject: [PATCH] Make chrome-launcher root package node 4 compat. * Fixes * - change tsconfig to target es5 - change tsconfig to include es2015 lib polyfills - change set iteration to use .forEach since this support is not present in es5 - make manual-chrome-launcher not use es2015 import syntax REF #8 --- chrome-launcher.ts | 7 +++++-- manual-chrome-launcher.js | 2 +- tsconfig.json | 9 ++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/chrome-launcher.ts b/chrome-launcher.ts index d9c0cb22b..53254d1bc 100644 --- a/chrome-launcher.ts +++ b/chrome-launcher.ts @@ -52,9 +52,12 @@ export interface ModuleOverrides { } const sigintListener = async () => { - for (const instance of instances) { + // Since sets are not iterable below es2015 we need + // too `.forEach` iterate over the set. + // https://github.com/Microsoft/TypeScript/issues/6842 + instances.forEach(async (instance) => { await instance.kill(); - } + }); process.exit(_SIGINT_EXIT_CODE); }; diff --git a/manual-chrome-launcher.js b/manual-chrome-launcher.js index be649de9a..fb65e83a3 100755 --- a/manual-chrome-launcher.js +++ b/manual-chrome-launcher.js @@ -14,7 +14,7 @@ */ require('./compiled-check.js')('chrome-launcher.js'); -const {launch} = require('./chrome-launcher'); +const launch = require('./chrome-launcher').launch; const args = process.argv.slice(2); let chromeFlags; diff --git a/tsconfig.json b/tsconfig.json index ecde405c0..6fb278b73 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es2016", + "target": "es5", "declaration": true, "noImplicitAny": true, "inlineSourceMap": true, @@ -9,7 +9,10 @@ "strictNullChecks": true, "noImplicitReturns": true, "noUnusedLocals": true, - "noUnusedParameters": true + "noUnusedParameters": true, + "lib": [ + "es2015" + ] }, "exclude": [ "node_modules" @@ -17,4 +20,4 @@ "include": [ "*.ts" ] -} +} \ No newline at end of file