8000 Simple fixes for the tests · johnangularjs/TypeScript@1f2a2d2 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 1f2a2d2

Browse files
committed
Simple fixes for the tests
1 parent 7439ee3 commit 1f2a2d2

File tree

2 files changed

+46
-41
lines changed

2 files changed

+46
-41
lines changed

scripts/importDefinitelyTypedTests.ts

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -33,44 +33,44 @@ function importDefinitelyTypedTest(testCaseName: string, testFiles: string[], re
3333
fs.mkdirSync(testDirectoryPath);
3434

3535
child_process.exec(cmd, {
36-
maxBuffer: 1 * 1024 * 1024,
37-
cwd: testDirectoryPath
38-
}, (error, stdout, stderr) => {
39-
//console.log("importing " + testCaseName + " ...");
40-
//console.log(cmd);
41-
42-
if (error) {
43-
console.log("importing " + testCaseName + " ...");
44-
console.log(cmd);
45-
console.log("==> error " + JSON.stringify(error));
46-
console.log("==> stdout " + String(stdout));
47-
console.log("==> stderr " + String(stderr));
48-
console.log("\r\n");
49-
return;
50-
}
51-
52-
// copy generated file to output location
53-
var outputFilePath = path.join(testDirectoryPath, "iocapture0.json");
54-
var testCasePath = path.join(rwcTestPath, "DefinitelyTyped_" + testCaseName + ".json");
55-
copyFileSync(outputFilePath, testCasePath);
56-
57-
//console.log("output generated at: " + outputFilePath);
58-
59-
if (!fs.existsSync(testCasePath)) {
60-
throw new Error("could not find test case at: " + testCasePath);
61-
}
62-
else {
63-
fs.unlinkSync(outputFilePath);
64-
fs.rmdirSync(testDirectoryPath);
65-
//console.log("testcase generated at: " + testCasePath);
66-
//console.log("Done.");
67-
}
68-
//console.log("\r\n");
69-
70-
})
71-
.on('error', function (error) {
72-
console.log("==> error " + JSON.stringify(error));
73-
console.log("\r\n");
36+
maxBuffer: 1 * 1024 * 1024,
37+
cwd: testDirectoryPath
38+
}, (error, stdout, stderr) => {
39+
console.log("importing " + testCaseName + " ...");
40+
console.log(cmd);
41+
42+
if (error) {
43+
console.log("importing " + testCaseName + " ...");
44+
console.log(cmd);
45+
console.log("==> error " + JSON.stringify(error));
46+
console.log("==> stdout " + String(stdout));
47+
console.log("==> stderr " + String(stderr));
48+
console.log("\r\n");
49+
return;
50+
}
51+
52+
// copy generated file to output location
53+
var outputFilePath = path.join(testDirectoryPath, "iocapture0.json");
54+
var testCasePath = path.join(rwcTestPath, "DefinitelyTyped_" + testCaseName + ".json");
55+
copyFileSync(outputFilePath, testCasePath);
56+
57+
//console.log("output generated at: " + outputFilePath);
58+
59+
if (!fs.existsSync(testCasePath)) {
60+
throw new Error("could not find test case at: " + testCasePath);
61+
}
62+
else {
63+
fs.unlinkSync(outputFilePath);
64+
fs.rmdirSync(testDirectoryPath);
65+
//console.log("testcase generated at: " + testCasePath);
66+
//console.log("Done.");
67+
}
68+
//console.log("\r\n");
69+
70+
})
71+
.on('error', function (error) {
72+
console.log("==> error " + JSON.stringify(error));
73+
console.log("\r\n");
7474
});
7575
}
7676

@@ -79,7 +79,8 @@ function importDefinitelyTypedTests(definitelyTypedRoot: string): void {
7979
if (err) throw err;
8080

8181
subDirectorys
82-
.filter(d => ["_infrastructure", "node_modules", ".git"].indexOf(d) >= 0)
82+
.filter(d => ["_infrastructure", "node_modules", ".git"].indexOf(d) < 0)
83+
.filter(i => i.indexOf("sipml") >=0 )
8384
.filter(i => fs.statSync(path.join(definitelyTypedRoot, i)).isDirectory())
8485
.forEach(d => {
8586
var directoryPath = path.join(definitelyTypedRoot, d);

tests/webTestServer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,15 @@ function handleRequestOperation(req: http.ServerRequest, res: http.ServerRespons
227227
send('success', res, null);
228228
break;
229229
case RequestType.DeleteFile:
230-
fs.unlinkSync(reqPath);
230+
if (fs.existsSync(reqPath)) {
231+
fs.unlinkSync(reqPath);
232+
}
231233
send('success', res, null);
232234
break;
233235
case RequestType.DeleteDir:
234-
fs.rmdirSync(reqPath);
236+
if (fs.existsSync(reqPath)) {
237+
fs.rmdirSync(reqPath);
238+
}
235239
send('success', res, null);
236240
break;
237241
case RequestType.AppendFile:

0 commit comments

Comments
 (0)
0