From 8a796e7db56da0b9b1eb2496d95dcd72953db42e Mon Sep 17 00:00:00 2001
From: Hans <hans@hansl.ca>
Date: Thu, 15 Nov 2018 11:49:46 -0800
Subject: [PATCH] test: downgrade output of typescript to es2016 for istanbul

---
 lib/bootstrap-local.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/bootstrap-local.js b/lib/bootstrap-local.js
index e0772ea117..c8194e11fb 100644
--- a/lib/bootstrap-local.js
+++ b/lib/bootstrap-local.js
@@ -16,9 +16,16 @@ const ts = require('typescript');
 
 const tmpRoot = temp.mkdirSync('angular-devkit-');
 
+const compilerOptions = ts.readConfigFile(path.join(__dirname, '../tsconfig.json'), p => {
+  return fs.readFileSync(p, 'utf-8');
+}).config;
+
 let _istanbulRequireHook = null;
 if (process.env['CODE_COVERAGE'] || process.argv.indexOf('--code-coverage') !== -1) {
   _istanbulRequireHook = require('./istanbul-local').istanbulRequireHook;
+  // async keyword isn't supported by the Esprima version used by Istanbul version used by us.
+  // TODO: update istanbul to istanbul-lib-* (see http://istanbul.js.org/) and remove this hack.
+  compilerOptions.compilerOptions.target = 'es2016';
 }
 
 
@@ -62,11 +69,6 @@ global._DevKitIsLocal = true;
 global._DevKitRoot = path.resolve(__dirname, '..');
 
 
-const compilerOptions = ts.readConfigFile(path.join(__dirname, '../tsconfig.json'), p => {
-  return fs.readFileSync(p, 'utf-8');
-}).config;
-
-
 const oldRequireTs = require.extensions['.ts'];
 require.extensions['.ts'] = function (m, filename) {
   // If we're in node module, either call the old hook or simply compile the