Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transpile error message format is different between different node versions #34662

Closed
JounQin opened this issue Oct 23, 2019 · 4 comments
Closed

transpile error message format is different between different node versions #34662

JounQin opened this issue Oct 23, 2019 · 4 comments

Comments

@JounQin
Copy link

@JounQin JounQin commented Oct 23, 2019

TypeScript Version: 3.6.4

Search Terms:
Error Message Formats

Code

import * as fs from 'fs'
import * as path from 'path'
import * as vm from 'vm'

import ts from 'typescript'

export const resolve = (...args: string[]): string =>
  path.resolve(__dirname, ...args)

export const read = (file: string): string =>
  fs.readFileSync(resolve(file) + '.ts').toString()

export const execute = (file: string, ...args: number[] | string[]) =>
  vm.runInNewContext(ts.transpile(read(file)), { exports: {} })(...args)

Expected behavior:

Error snapshots match for all node versions

Actual behavior:

Matched on node 8.x and 10.x, breaks on 12.x

image

Playground Link:

GitHub Actions

Plain logs:

Node 8.x
Node 10.x
Node 12.x

Related Issues:

@RyanCavanaugh

This comment has been minimized.

Copy link
Member

@RyanCavanaugh RyanCavanaugh commented Oct 23, 2019

The "Node 12.x" link is broken. Can you paste the text as text in the issue? Thanks!

@JounQin

This comment has been minimized.

@IllusionMH

This comment has been minimized.

Copy link
Contributor

@IllusionMH IllusionMH commented Oct 24, 2019

Are you sure it's not an exception from Node?

image

Can't find anything similar in TS sources.

@JounQin

This comment has been minimized.

Copy link
Author

@JounQin JounQin commented Oct 24, 2019

Wow, it should be related to Node itself then. Thanks for your work.

@JounQin JounQin closed this Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.