Skip to content

Commit d5aa839

Browse files
author
Armando Aguirre
committed
Fixed indentation.
1 parent 0543522 commit d5aa839

File tree

1 file changed

+85
-85
lines changed

1 file changed

+85
-85
lines changed

Nodejs/Product/TestAdapter/TestFrameworks/ExportRunner/exportrunner.js

Lines changed: 85 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -2,111 +2,111 @@ var fs = require('fs');
22
var path = require('path');
33
var vm = require('vm');
44
var result = {
5-
'title': '',
6-
'passed': false,
7-
'stdOut': '',
8-
'stdErr': ''
5+
'title': '',
6+
'passed': false,
7+
'stdOut': '',
8+
'stdErr': ''
99
};
1010

1111
function append_stdout(string, encoding, fd) {
12-
result.stdOut += string;
12+
result.stdOut += string;
1313
}
1414
function append_stderr(string, encoding, fd) {
15-
result.stdErr += string;
15+
result.stdErr += string;
1616
}
1717
function hook_outputs() {
18-
process.stdout.write = append_stdout;
19-
process.stderr.write = append_stderr;
18+
process.stdout.write = append_stdout;
19+
process.stderr.write = append_stderr;
2020
}
2121

2222
hook_outputs();
2323

2424
var find_tests = function (testFileList, discoverResultFile) {
25-
var debug;
26-
try {
27-
debug = vm.runInDebugContext('Debug');
28-
} catch (ex) {
29-
console.error("NTVS_ERROR:", ex);
30-
}
25+
var debug;
26+
try {
27+
debug = vm.runInDebugContext('Debug');
28+
} catch (ex) {
29+
console.error("NTVS_ERROR:", ex);
30+
}
3131

32-
var testList = [];
33-
testFileList.split(';').forEach(function (testFile) {
34-
var testCases;
35-
process.chdir(path.dirname(testFile));
36-
try {
37-
testCases = require(testFile);
38-
} catch (ex) {
39-
console.error("NTVS_ERROR:", ex, "in", testFile);
40-
return;
41-
}
42-
for (var test in testCases) {
43-
var line = 0;
44-
var column = 0;
45-
if (debug !== undefined) {
46-
try {
47-
var funcDetails = debug.findFunctionSourceLocation(testCases[test]);
48-
if (funcDetails != undefined) {
49-
line = funcDetails.line; // 0 based
50-
column = funcDetails.column; // 0 based
51-
}
52-
} catch (e) {
53-
//If we take an exception mapping the source line, simply fallback to unknown source map
54-
}
55-
}
56-
testList.push({
57-
test: test,
58-
suite: '',
59-
file: testFile,
60-
line: line,
61-
column: column
62-
});
63-
}
64-
});
32+
var testList = [];
33+
testFileList.split(';').forEach(function (testFile) {
34+
var testCases;
35+
process.chdir(path.dirname(testFile));
36+
try {
37+
testCases = require(testFile);
38+
} catch (ex) {
39+
console.error("NTVS_ERROR:", ex, "in", testFile);
40+
return;
41+
}
42+
for (var test in testCases) {
43+
var line = 0;
44+
var column = 0;
45+
if (debug !== undefined) {
46+
try {
47+
var funcDetails = debug.findFunctionSourceLocation(testCases[test]);
48+
if (funcDetails != undefined) {
49+
line = funcDetails.line; // 0 based
50+
column = funcDetails.column; // 0 based
51+
}
52+
} catch (e) {
53+
//If we take an exception mapping the source line, simply fallback to unknown source map
54+
}
55+
}
56+
testList.push({
57+
test: test,
58+
suite: '',
59+
file: testFile,
60+
line: line,
61+
column: column
62+
});
63+
}
64+
});
6565

66-
var fd = fs.openSync(discoverResultFile, 'w');
67-
fs.writeSync(fd, JSON.stringify(testList));
68-
fs.closeSync(fd);
66+
var fd = fs.openSync(discoverResultFile, 'w');
67+
fs.writeSync(fd, JSON.stringify(testList));
68+
fs.closeSync(fd);
6969
};
7070
module.exports.find_tests = find_tests;
7171

7272
var run_tests = function (testCases, callback) {
73-
function post(event) {
74-
callback(event);
75-
hook_outputs();
76-
}
73+
function post(event) {
74+
callback(event);
75+
hook_outputs();
76+
}
7777

78-
for (var test of testCases) {
79-
post({
80-
type: 'test start',
81-
title: test.testName
82-
});
83-
try {
84-
var testCase = require(test.testFile);
85-
result.title = test.testName;
86-
testCase[test.testName]();
78+
for (var test of testCases) {
79+
post({
80+
type: 'test start',
81+
title: test.testName
82+
});
83+
try {
84+
var testCase = require(test.testFile);
85+
result.title = test.testName;
86+
testCase[test.testName]();
8787
result.passed = true;
8888
result.stdOut += "Test passed.\n";
89-
} catch (err) {
90-
result.passed = false;
91-
console.error(err.name);
92-
console.error(err.message);
93-
}
94-
post({
95-
type: 'result',
96-
title: test.testName,
97-
result: result
98-
});
99-
result = {
100-
'title': '',
101-
'passed': false,
102-
'stdOut': '',
103-
'stdErr': ''
104-
};
105-
}
106-
callback({
107-
type: 'suite end',
108-
result: result
109-
});
110-
process.exit();
89+
} catch (err) {
90+
result.passed = false;
91+
console.error(err.name);
92+
console.error(err.message);
93+
}
94+
post({
95+
type: 'result',
96+
title: test.testName,
97+
result: result
98+
});
99+
result = {
100+
'title': '',
101+
'passed': false,
102+
'stdOut': '',
103+
'stdErr': ''
104+
};
105+
}
106+
callback({
107+
type: 'suite end',
108+
result: result
109+
});
110+
process.exit();
111111
};
112112
module.exports.run_tests = run_tests;

0 commit comments

Comments
 (0)