Skip to content

Commit 3202d59

Browse files
committed
Merge remote-tracking branch 'refs/remotes/Microsoft/master'
2 parents 80c04f8 + 0041d5c commit 3202d59

File tree

219 files changed

+5657
-1687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+5657
-1687
lines changed

Gulpfile.ts

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ declare module "gulp-typescript" {
1717
stripInternal?: boolean;
1818
types?: string[];
1919
}
20-
interface CompileStream extends NodeJS.ReadWriteStream {} // Either gulp or gulp-typescript has some odd typings which don't reflect reality, making this required
20+
interface CompileStream extends NodeJS.ReadWriteStream { } // Either gulp or gulp-typescript has some odd typings which don't reflect reality, making this required
2121
}
2222
import * as insert from "gulp-insert";
2323
import * as sourcemaps from "gulp-sourcemaps";
@@ -65,7 +65,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
6565
}
6666
});
6767

68-
function exec(cmd: string, args: string[], complete: () => void = (() => {}), error: (e: any, status: number) => void = (() => {})) {
68+
function exec(cmd: string, args: string[], complete: () => void = (() => { }), error: (e: any, status: number) => void = (() => { })) {
6969
console.log(`${cmd} ${args.join(" ")}`);
7070
// TODO (weswig): Update child_process types to add windowsVerbatimArguments to the type definition
7171
const subshellFlag = isWin ? "/c" : "-c";
@@ -116,12 +116,12 @@ const es2015LibrarySources = [
116116
];
117117

118118
const es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {
119-
return { target: "lib." + source, sources: ["header.d.ts", source] };
119+
return { target: "lib." + source, sources: ["header.d.ts", source] };
120120
});
121121

122-
const es2016LibrarySource = [ "es2016.array.include.d.ts" ];
122+
const es2016LibrarySource = ["es2016.array.include.d.ts"];
123123

124-
const es2016LibrarySourceMap = es2016LibrarySource.map(function (source) {
124+
const es2016LibrarySourceMap = es2016LibrarySource.map(function(source) {
125125
return { target: "lib." + source, sources: ["header.d.ts", source] };
126126
});
127127

@@ -130,38 +130,38 @@ const es2017LibrarySource = [
130130
"es2017.sharedmemory.d.ts"
131131
];
132132

133-
const es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
133+
const es2017LibrarySourceMap = es2017LibrarySource.map(function(source) {
134134
return { target: "lib." + source, sources: ["header.d.ts", source] };
135135
});
136136

137137
const hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];
138138

139139
const librarySourceMap = [
140-
// Host library
141-
{ target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"] },
142-
{ target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"] },
143-
{ target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"] },
144-
{ target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"] },
145-
146-
// JavaScript library
147-
{ target: "lib.es5.d.ts", sources: ["header.d.ts", "es5.d.ts"] },
148-
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
149-
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
150-
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
151-
152-
// JavaScript + all host library
153-
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
154-
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") }
140+
// Host library
141+
{ target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"] },
142+
{ target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"] },
143+
{ target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"] },
144+
{ target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"] },
145+
146+
// JavaScript library
147+
{ target: "lib.es5.d.ts", sources: ["header.d.ts", "es5.d.ts"] },
148+
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
149+
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
150+
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
151+
152+
// JavaScript + all host library
153+
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
154+
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") }
155155
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap);
156156

157-
const libraryTargets = librarySourceMap.map(function (f) {
157+
const libraryTargets = librarySourceMap.map(function(f) {
158158
return path.join(builtLocalDirectory, f.target);
159159
});
160160

161161
for (const i in libraryTargets) {
162162
const entry = librarySourceMap[i];
163163
const target = libraryTargets[i];
164-
const sources = [copyright].concat(entry.sources.map(function (s) {
164+
const sources = [copyright].concat(entry.sources.map(function(s) {
165165
return path.join(libraryDirectory, s);
166166
}));
167167
gulp.task(target, false, [], function() {
@@ -391,7 +391,7 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
391391
.pipe(sourcemaps.init())
392392
.pipe(tsc(servicesProject));
393393
const completedJs = js.pipe(prependCopyright())
394-
.pipe(sourcemaps.write("."));
394+
.pipe(sourcemaps.write("."));
395395
const completedDts = dts.pipe(prependCopyright(/*outputCopyright*/true))
396396
.pipe(insert.transform((contents, file) => {
397397
file.path = standaloneDefinitionsFile;
@@ -434,17 +434,17 @@ const tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverli
434434

435435
gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => {
436436
const serverLibraryProject = tsc.createProject("src/server/tsconfig.library.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
437-
const {js, dts}: {js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream} = serverLibraryProject.src()
437+
const {js, dts}: { js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream } = serverLibraryProject.src()
438438
.pipe(sourcemaps.init())
439439
.pipe(newer(tsserverLibraryFile))
440440
.pipe(tsc(serverLibraryProject));
441441

442442
return merge2([
443443
js.pipe(prependCopyright())
444-
.pipe(sourcemaps.write("."))
445-
.pipe(gulp.dest(builtLocalDirectory)),
444+
.pipe(sourcemaps.write("."))
445+
.pipe(gulp.dest(builtLocalDirectory)),
446446
dts.pipe(prependCopyright())
447-
.pipe(gulp.dest(builtLocalDirectory))
447+
.pipe(gulp.dest(builtLocalDirectory))
448448
]);
449449
});
450450

@@ -476,7 +476,7 @@ gulp.task(specMd, false, [word2mdJs], (done) => {
476476
const specMDFullPath = path.resolve(specMd);
477477
const cmd = "cscript //nologo " + word2mdJs + " \"" + specWordFullPath + "\" " + "\"" + specMDFullPath + "\"";
478478
console.log(cmd);
479-
cp.exec(cmd, function () {
479+
cp.exec(cmd, function() {
480480
done();
481481
});
482482
});
@@ -492,12 +492,12 @@ gulp.task("dontUseDebugMode", false, [], (done) => { useDebugMode = false; done(
492492

493493
gulp.task("VerifyLKG", false, [], () => {
494494
const expectedFiles = [builtLocalCompiler, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile].concat(libraryTargets);
495-
const missingFiles = expectedFiles.filter(function (f) {
495+
const missingFiles = expectedFiles.filter(function(f) {
496496
return !fs.existsSync(f);
497497
});
498498
if (missingFiles.length > 0) {
499499
throw new Error("Cannot replace the LKG unless all built targets are present in directory " + builtLocalDirectory +
500-
". The following files are missing:\n" + missingFiles.join("\n"));
500+
". The following files are missing:\n" + missingFiles.join("\n"));
501501
}
502502
// Copy all the targets into the LKG directory
503503
return gulp.src(expectedFiles).pipe(gulp.dest(LKGDirectory));
@@ -531,8 +531,6 @@ const localRwcBaseline = path.join(internalTests, "baselines/rwc/local");
531531
const refRwcBaseline = path.join(internalTests, "baselines/rwc/reference");
532532

533533
const localTest262Baseline = path.join(internalTests, "baselines/test262/local");
534-
const refTest262Baseline = path.join(internalTests, "baselines/test262/reference");
535-
536534

537535
gulp.task("tests", "Builds the test infrastructure using the built compiler", [run]);
538536
gulp.task("tests-debug", "Builds the test sources and automation in debug mode", () => {
@@ -553,7 +551,7 @@ function restoreSavedNodeEnv() {
553551
process.env.NODE_ENV = savedNodeEnv;
554552
}
555553

556-
let testTimeout = 20000;
554+
let testTimeout = 40000;
557555
function runConsoleTests(defaultReporter: string, runInParallel: boolean, done: (e?: any) => void) {
558556
const lintFlag = cmdLineOptions["lint"];
559557
cleanTestDirs((err) => {
@@ -627,7 +625,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
627625
}
628626
args.push(run);
629627
setNodeEnvToDevelopment();
630-
runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: colors === " --no-colors " }, function (err) {
628+
runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: colors === " --no-colors " }, function(err) {
631629
// last worker clean everything and runs linter in case if there were no errors
632630
del(taskConfigsFolder).then(() => {
633631
if (!err) {
@@ -679,7 +677,7 @@ gulp.task("runtests",
679677
["build-rules", "tests"],
680678
(done) => {
681679
runConsoleTests("mocha-fivemat-progress-reporter", /*runInParallel*/ false, done);
682-
});
680+
});
683681

684682
const nodeServerOutFile = "tests/webTestServer.js";
685683
const nodeServerInFile = "tests/webTestServer.ts";
@@ -811,32 +809,36 @@ gulp.task("diff-rwc", "Diffs the RWC baselines using the diff tool specified by
811809
exec(getDiffTool(), [refRwcBaseline, localRwcBaseline], done, done);
812810
});
813811

814-
815-
gulp.task("baseline-accept", "Makes the most recent test results the new baseline, overwriting the old baseline", (done) => {
816-
const softAccept = cmdLineOptions["soft"];
817-
if (!softAccept) {
818-
del(refBaseline).then(() => {
819-
fs.renameSync(localBaseline, refBaseline);
820-
done();
821-
}, done);
822-
}
823-
else {
824-
gulp.src(localBaseline)
825-
.pipe(gulp.dest(refBaseline))
826-
.on("end", () => {
827-
del(path.join(refBaseline, "local")).then(() => done(), done);
828-
});
829-
}
812+
gulp.task("baseline-accept", "Makes the most recent test results the new baseline, overwriting the old baseline", () => {
813+
return baselineAccept("");
830814
});
815+
816+
function baselineAccept(subfolder = "") {
817+
return merge2(baselineCopy(subfolder), baselineDelete(subfolder));
818+
}
819+
820+
function baselineCopy(subfolder = "") {
821+
return gulp.src([`tests/baselines/local/${subfolder}/**`, `!tests/baselines/local/${subfolder}/**/*.delete`])
822+
.pipe(gulp.dest(refBaseline));
823+
}
824+
825+
function baselineDelete(subfolder = "") {
826+
return gulp.src(["tests/baselines/local/**/*.delete"])
827+
.pipe(insert.transform((content, fileObj) => {
828+
const target = path.join(refBaseline, fileObj.relative.substr(0, fileObj.relative.length - ".delete".length));
829+
del.sync(target);
830+
del.sync(fileObj.path);
831+
return "";
832+
}));
833+
}
834+
831835
gulp.task("baseline-accept-rwc", "Makes the most recent rwc test results the new baseline, overwriting the old baseline", () => {
832-
return del(refRwcBaseline).then(() => {
833-
fs.renameSync(localRwcBaseline, refRwcBaseline);
834-
});
836+
return baselineAccept("rwc");
835837
});
838+
839+
836840
gulp.task("baseline-accept-test262", "Makes the most recent test262 test results the new baseline, overwriting the old baseline", () => {
837-
return del(refTest262Baseline).then(() => {
838-
fs.renameSync(localTest262Baseline, refTest262Baseline);
839-
});
841+
return baselineAccept("test262");
840842
});
841843

842844

0 commit comments

Comments
 (0)