Skip to content

Commit

Permalink
Tweak tests to be absolutely sure sourcemaps are working
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed May 12, 2020
1 parent db952a6 commit 4f43556
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.spec.ts
Expand Up @@ -189,7 +189,7 @@ describe('ts-node', function () {
}

expect(err.message).to.contain([
`${join(__dirname, '../tests/throw.ts')}:3`,
`${join(__dirname, '../tests/throw.ts')}:11`,
' bar () { throw new Error(\'this is a demo\') }',
' ^',
'Error: this is a demo'
Expand All @@ -206,7 +206,7 @@ describe('ts-node', function () {
}

expect(err.message).to.contain([
`${join(__dirname, '../tests/throw.ts')}:3`,
`${join(__dirname, '../tests/throw.ts')}:11`,
' bar () { throw new Error(\'this is a demo\') }',
' ^'
].join('\n'))
Expand Down Expand Up @@ -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')}:11:18)`
].join('\n'))

done()
Expand Down
8 changes: 8 additions & 0 deletions tests/throw.ts
@@ -1,4 +1,12 @@
// intentional whitespace to prove that sourcemaps are working
class Foo {







constructor () { this.bar() }
bar () { throw new Error('this is a demo') }
}
Expand Down

0 comments on commit 4f43556

Please sign in to comment.