Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions Nodejs/Product/Nodejs/TestFrameworks/ExportRunner/exportrunner.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
var fs = require('fs');
var path = require('path');
var vm = require('vm');

var find_tests = function (testFileList, discoverResultFile) {
var debug;
try {
debug = vm.runInDebugContext('Debug');
} catch (ex) {
console.error("NTVS_ERROR:", ex);
}

var testList = [];
testFileList.split(';').forEach(function (testFile) {
var testCases;
Expand All @@ -13,16 +21,16 @@ var find_tests = function (testFileList, discoverResultFile) {
return;
}
for (var test in testCases) {
var line = 0;
var column = 0;
if (dbg != undefined) {
var line = 1; // line 0 doesn't exist in editor
var column = 1;
if (debug !== undefined) {
try {
var funcDetails = dbg.Debug.findFunctionSourceLocation(testCases[test]);
var funcDetails = debug.findFunctionSourceLocation(testCases[test]);
if (funcDetails != undefined) {
//v8 is 0 based line numbers, editor is 1 based
line = parseInt(funcDetails.line) + 1;
//v8 and editor are both 1 based column numbers, no adjustment necessary
column = parseInt(funcDetails.column);
//v8 is 0 based column numbers, editor is 1 based
column = parseInt(funcDetails.column) + 1;
}
} catch (e) {
//If we take an exception mapping the source line, simply fallback to unknown source map
Expand Down
2 changes: 1 addition & 1 deletion Nodejs/Product/TestAdapter/TestFrameworks/TestFramework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private string WrapTestNameWithQuotes(string testName) {

private string EvaluateJavaScript(string nodeExePath, string testFile, string discoverResultFile, IMessageLogger logger, string workingDirectory) {
workingDirectory = workingDirectory.TrimEnd(new char['\\']);
string arguments = "--expose_debug_as=dbg " + WrapWithQuotes(_findTestsScriptFile)
string arguments = WrapWithQuotes(_findTestsScriptFile)
+ " " + Name +
" " + WrapWithQuotes(testFile) +
" " + WrapWithQuotes(discoverResultFile) +
Expand Down