diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..64eb438 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +.gitattributes text eol=lf \ No newline at end of file diff --git a/example.ts b/example.ts index a201bd7..e3d121c 100644 --- a/example.ts +++ b/example.ts @@ -1 +1,22 @@ console.log('Some .ts code reproducing a bug'); +/* some comment */ +function someFunc() { + throw new Error("Error2 "); // Line 4 +} +; (() => { + try { + /* some comment */ + someFunc(); // Line 9 + } + catch (err) { + /* some comment */ + // console.log("Error Found", err); + + const a = err.stack.split("\n").filter(x => x.match(/example.ts/)); + const lineNumbers = a.map((x) => parseInt(x.match(/\:([0-9]+)/)[1], 10)); + console.log(lineNumbers); + if (lineNumbers.join(",") !== "4,9,22") { + throw new Error("Invalid line number : expecting 4,9,22 and got " + lineNumbers.join(",")); + } + } +})(); // Line 22 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..329ac0a --- /dev/null +++ b/package-lock.json @@ -0,0 +1,11 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "typescript": { + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", + "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==" + } + } +} diff --git a/package.json b/package.json index 4d56496..db8b135 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "dependencies": { - "ts-node": "latest", - "typescript": "latest" + "typescript": "^3.9.3" } } diff --git a/run.sh b/run.sh index d553b44..34d9eae 100644 --- a/run.sh +++ b/run.sh @@ -4,10 +4,12 @@ n lts # Install package.json dependencies -yarn +npm install # Run ts-node -yarn ts-node ./example.ts +npx ts-node@8.9 example.ts + +npx ts-node@8.10 example.ts echo "Process exited with code: $?" echo