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

change value to pass as an argument (for --prefer-ts-exts) #867

Merged
merged 3 commits into from Sep 15, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/index.spec.ts
Expand Up @@ -288,6 +288,15 @@ describe('ts-node', function () {
})
})

it('should import ts before js when TS_NODE_PREFER_TS_EXTS env is present', function (done) {
exec(`${BIN_EXEC} tests/import-order/compiled`, { env: { ...process.env, TS_NODE_PREFER_TS_EXTS: 'true' } }, function (err, stdout) {
expect(err).to.equal(null)
expect(stdout).to.equal('Hello, TypeScript!\n')

return done()
})
})

it('should ignore .d.ts files', function (done) {
exec(`${BIN_EXEC} tests/import-order/importer`, function (err, stdout) {
expect(err).to.equal(null)
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -401,7 +401,7 @@ export function register (opts: Options = {}): Register {
const register: Register = { cwd, compile, getTypeInfo, extensions, ts }

// Register the extensions.
registerExtensions(opts, extensions, ignore, register, originalJsHandler)
registerExtensions(options, extensions, ignore, register, originalJsHandler)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pass through only options.preferTsExts, I think that's the only thing used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I'll fix it.


return register
}
Expand Down