Skip to content

Commit

Permalink
Put "ts-node" object at the top of --showConfig output (#1355)
Browse files Browse the repository at this point in the history
* Put "ts-node" at the top of `--showConfig` output

* update test to match new behavior

* Fix lint failure
  • Loading branch information
cspotcode authored Jun 6, 2021
1 parent 17b3a55 commit 518c250
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
22 changes: 12 additions & 10 deletions src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,18 @@ export function main(
);
process.exit(1);
}
const json = ts.convertToTSConfig(
service.config,
service.configFilePath ?? join(cwd, 'ts-node-implicit-tsconfig.json'),
service.ts.sys
);
json['ts-node'] = {
...service.options,
experimentalEsmLoader: undefined,
compilerOptions: undefined,
project: service.configFilePath ?? service.options.project,
const json = {
['ts-node']: {
...service.options,
experimentalEsmLoader: undefined,
compilerOptions: undefined,
project: service.configFilePath ?? service.options.project,
},
...ts.convertToTSConfig(
service.config,
service.configFilePath ?? join(cwd, 'ts-node-implicit-tsconfig.json'),
service.ts.sys
),
};
console.log(
// Assumes that all configuration options which can possibly be specified via the CLI are JSON-compatible.
Expand Down
12 changes: 6 additions & 6 deletions src/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,12 @@ test.suite('ts-node', (test) => {
stdout,
JSON.stringify(
{
'ts-node': {
cwd: native(`${ROOT_DIR}/tests`),
projectSearchDir: native(`${ROOT_DIR}/tests`),
project: native(`${ROOT_DIR}/tests/tsconfig.json`),
require: [],
},
compilerOptions: {
target: 'es6',
jsx: 'react',
Expand All @@ -904,12 +910,6 @@ test.suite('ts-node', (test) => {
outDir: './.ts-node',
module: 'commonjs',
},
'ts-node': {
cwd: native(`${ROOT_DIR}/tests`),
projectSearchDir: native(`${ROOT_DIR}/tests`),
project: native(`${ROOT_DIR}/tests/tsconfig.json`),
require: [],
},
},
null,
2
Expand Down

0 comments on commit 518c250

Please sign in to comment.