From f588826887138afbf8896719df1145ded1652f77 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Tue, 12 May 2020 13:53:44 -0400 Subject: [PATCH] Tweak tests to be absolutely sure sourcemaps are working --- src/index.spec.ts | 6 +-- tests/throw.ts | 97 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 3 deletions(-) diff --git a/src/index.spec.ts b/src/index.spec.ts index 0d41f65d2..064f42ee0 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -189,7 +189,7 @@ describe('ts-node', function () { } expect(err.message).to.contain([ - `${join(__dirname, '../tests/throw.ts')}:3`, + `${join(__dirname, '../tests/throw.ts')}:100`, ' bar () { throw new Error(\'this is a demo\') }', ' ^', 'Error: this is a demo' @@ -206,7 +206,7 @@ describe('ts-node', function () { } expect(err.message).to.contain([ - `${join(__dirname, '../tests/throw.ts')}:3`, + `${join(__dirname, '../tests/throw.ts')}:100`, ' bar () { throw new Error(\'this is a demo\') }', ' ^' ].join('\n')) @@ -611,7 +611,7 @@ describe('ts-node', function () { } catch (error) { expect(error.stack).to.contain([ 'Error: this is a demo', - ` at Foo.bar (${join(__dirname, '../tests/throw.ts')}:3:18)` + ` at Foo.bar (${join(__dirname, '../tests/throw.ts')}:100:18)` ].join('\n')) done() diff --git a/tests/throw.ts b/tests/throw.ts index 1183d9ff5..dbd4cbc2e 100644 --- a/tests/throw.ts +++ b/tests/throw.ts @@ -1,4 +1,101 @@ +// intentional whitespace to prove that sourcemaps are working. Throw should happen on line 100. +// 100 lines is meant to be far more space than the helper functions would take. class Foo { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + constructor () { this.bar() } bar () { throw new Error('this is a demo') } }