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

build: remove ts-node dev-dependency #602

Merged
merged 1 commit into from
Oct 5, 2017
Merged

build: remove ts-node dev-dependency #602

merged 1 commit into from
Oct 5, 2017

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Oct 2, 2017

Refactor project infrastructure to transpile test files together with production code and then run the tests from plain javascript code.

Benefits:

  • consistent error message parseable by VSCode's $tsc problem matcher
    (compiler errors from test files will show in Problems window now)

  • earlier feedback about type-related problems in test files,
    no need to wait for ts-node to load type information from
    tsc output

  • slightly faster red-green-refactor cycle,
    npm test takes 27s instead of 32s.

  • we are opening doors to eventually start using tsc --watch
    once TypeScript adds support for multi-project repositories,
    see Support "medium-sized" projects microsoft/TypeScript#3469

@bajtos
Copy link
Member Author

bajtos commented Oct 2, 2017

A high-level summary of the changes:

  • In each package, we are compiling both src and test to dist and dist6 folders. Files that used to be in lib are in dist/src now, lib6 files are in dist6/src now.
  • All package.json files were updated to use dist* instead of lib*.
  • Package-level index.js redirects to dist/src instead of lib and dist6/src instead of lib6.

TODO: figure out how to tell mocha to use dist6/test when running on Node.js 6.x

@bajtos bajtos changed the title build: remove ts-node dev-dependency [WIP] build: remove ts-node dev-dependency Oct 2, 2017
@bajtos bajtos changed the title [WIP] build: remove ts-node dev-dependency build: remove ts-node dev-dependency Oct 4, 2017
@bajtos
Copy link
Member Author

bajtos commented Oct 4, 2017

TODO: figure out how to tell mocha to use dist6/test when running on Node.js 6.x

Done in 519a815.

This pull request is ready for final review and landing. @raymondfeng @kjdelisle @virkt25 PTAL.

Refactor project infrastructure to transpile test files together with
production code and then run the tests from plain javascript code.

Benefits:

 - consistent error message parseable by VSCode's $tsc problem matcher
   (compiler errors from test files will show in Problems window now)

 - earlier feedback about type-related problems in test files,
   no need to wait for ts-node to load type information from
   tsc output

 - slightly faster red-green-refactor cycle,
   `npm test` takes 27s instead of 32s.

 - we are opening doors to eventually start using `tsc --watch`
   once TypeScript adds support for multi-project repositories,
   see microsoft/TypeScript#3469
@bajtos bajtos merged commit 3698d76 into master Oct 5, 2017
@bajtos bajtos deleted the build/remove-tsnode branch October 5, 2017 10:33
@bajtos bajtos removed the review label Oct 5, 2017
bajtos added a commit that referenced this pull request Jan 22, 2018
When we got rid of ts-node in #602, we also unintentionally dropped
the code modifying error stack traces to point to original TypeScript
sources instead of the transpiled JavaScript output.

As a result, assertion failures contained stack traces pointing to code
that we are not familiar with, which made troubleshooing difficult.

This commits add source-map-support as a dependency of our projects
and modifies shared `mocha.opts` to register it at runtime.
@bajtos bajtos mentioned this pull request Jan 22, 2018
6 tasks
bajtos added a commit that referenced this pull request Jan 23, 2018
When we got rid of ts-node in #602, we also unintentionally dropped
the code modifying error stack traces to point to original TypeScript
sources instead of the transpiled JavaScript output.

As a result, assertion failures contained stack traces pointing to code
that we are not familiar with, which made troubleshooing difficult.

This commits add source-map-support as a dependency of our projects
and modifies shared `mocha.opts` to register it at runtime.
bajtos added a commit that referenced this pull request Jan 25, 2018
When we got rid of ts-node in #602, we also unintentionally dropped
the code modifying error stack traces to point to original TypeScript
sources instead of the transpiled JavaScript output.

As a result, assertion failures contained stack traces pointing to code
that we are not familiar with, which made troubleshooing difficult.

This commits add source-map-support as a global dev-dependency
plus a dev-dependency of example repositories that must work outside
of our monorepo too.

The single shared `mocha.opts` was split into two different options
files:

 - `mocha.ts.opts` which registers source-map support
 - `mocha.js.opts` with no support for source maps
bajtos added a commit that referenced this pull request Jan 25, 2018
When we got rid of ts-node in #602, we also unintentionally dropped
the code modifying error stack traces to point to original TypeScript
sources instead of the transpiled JavaScript output.

As a result, assertion failures contained stack traces pointing to code
that we are not familiar with, which made troubleshooing difficult.

This commits add source-map-support as a global dev-dependency
plus a dev-dependency of example repositories that must work outside
of our monorepo too.

The single shared `mocha.opts` was split into two different options
files:

 - `mocha.ts.opts` which registers source-map support
 - `mocha.js.opts` with no support for source maps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants