Skip to content

Commit 8d44e48

Browse files
authored
Fix instrumenter target + deprecation warning (#17973)
1 parent 15e15ab commit 8d44e48

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Gulpfile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ const instrumenterPath = path.join(harnessDirectory, "instrumenter.ts");
978978
const instrumenterJsPath = path.join(builtLocalDirectory, "instrumenter.js");
979979
gulp.task(instrumenterJsPath, /*help*/ false, [servicesFile], () => {
980980
const settings: tsc.Settings = getCompilerSettings({
981-
outFile: instrumenterJsPath,
981+
module: "commonjs",
982982
target: "es5",
983983
lib: [
984984
"es6",
@@ -990,8 +990,8 @@ gulp.task(instrumenterJsPath, /*help*/ false, [servicesFile], () => {
990990
.pipe(newer(instrumenterJsPath))
991991
.pipe(sourcemaps.init())
992992
.pipe(tsc(settings))
993-
.pipe(sourcemaps.write("."))
994-
.pipe(gulp.dest("."));
993+
.pipe(sourcemaps.write(builtLocalDirectory))
994+
.pipe(gulp.dest(builtLocalDirectory));
995995
});
996996

997997
gulp.task("tsc-instrumented", "Builds an instrumented tsc.js", ["local", loggedIOJsPath, instrumenterJsPath, servicesFile], (done) => {

Jakefile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ file(loggedIOJsPath, [builtLocalDirectory, loggedIOpath], function () {
10981098

10991099
var instrumenterPath = harnessDirectory + 'instrumenter.ts';
11001100
var instrumenterJsPath = builtLocalDirectory + 'instrumenter.js';
1101-
compileFile(instrumenterJsPath, [instrumenterPath], [tscFile, instrumenterPath].concat(libraryTargets), [], /*useBuiltCompiler*/ true, { lib: "es6", types: ["node"] });
1101+
compileFile(instrumenterJsPath, [instrumenterPath], [tscFile, instrumenterPath].concat(libraryTargets), [], /*useBuiltCompiler*/ true, { lib: "es6", types: ["node"], noOutFile: true, outDir: builtLocalDirectory });
11021102

11031103
desc("Builds an instrumented tsc.js");
11041104
task('tsc-instrumented', [loggedIOJsPath, instrumenterJsPath, tscFile], function () {

src/harness/instrumenter.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const fs: any = require("fs");
2-
const path: any = require("path");
1+
import fs = require("fs");
2+
import path = require("path");
33

44
function instrumentForRecording(fn: string, tscPath: string) {
55
instrument(tscPath, `
@@ -38,7 +38,9 @@ function instrument(tscPath: string, prepareCode: string, cleanupCode = "") {
3838

3939
const index2 = index1 + invocationLine.length;
4040
const newContent = tscContent.substr(0, index1) + loggerContent + prepareCode + invocationLine + cleanupCode + tscContent.substr(index2) + "\r\n";
41-
fs.writeFile(tscPath, newContent);
41+
fs.writeFile(tscPath, newContent, err => {
42+
if (err) throw err;
43+
});
4244
});
4345
});
4446
});

0 commit comments

Comments
 (0)