Skip to content

Commit 518c250

Browse files
authored
Put "ts-node" object at the top of --showConfig output (#1355)
* Put "ts-node" at the top of `--showConfig` output * update test to match new behavior * Fix lint failure
1 parent 17b3a55 commit 518c250

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/bin.ts

+12-10
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,18 @@ export function main(
213213
);
214214
process.exit(1);
215215
}
216-
const json = ts.convertToTSConfig(
217-
service.config,
218-
service.configFilePath ?? join(cwd, 'ts-node-implicit-tsconfig.json'),
219-
service.ts.sys
220-
);
221-
json['ts-node'] = {
222-
...service.options,
223-
experimentalEsmLoader: undefined,
224-
compilerOptions: undefined,
225-
project: service.configFilePath ?? service.options.project,
216+
const json = {
217+
['ts-node']: {
218+
...service.options,
219+
experimentalEsmLoader: undefined,
220+
compilerOptions: undefined,
221+
project: service.configFilePath ?? service.options.project,
222+
},
223+
...ts.convertToTSConfig(
224+
service.config,
225+
service.configFilePath ?? join(cwd, 'ts-node-implicit-tsconfig.json'),
226+
service.ts.sys
227+
),
226228
};
227229
console.log(
228230
// Assumes that all configuration options which can possibly be specified via the CLI are JSON-compatible.

src/test/index.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,12 @@ test.suite('ts-node', (test) => {
888888
stdout,
889889
JSON.stringify(
890890
{
891+
'ts-node': {
892+
cwd: native(`${ROOT_DIR}/tests`),
893+
projectSearchDir: native(`${ROOT_DIR}/tests`),
894+
project: native(`${ROOT_DIR}/tests/tsconfig.json`),
895+
require: [],
896+
},
891897
compilerOptions: {
892898
target: 'es6',
893899
jsx: 'react',
@@ -904,12 +910,6 @@ test.suite('ts-node', (test) => {
904910
outDir: './.ts-node',
905911
module: 'commonjs',
906912
},
907-
'ts-node': {
908-
cwd: native(`${ROOT_DIR}/tests`),
909-
projectSearchDir: native(`${ROOT_DIR}/tests`),
910-
project: native(`${ROOT_DIR}/tests/tsconfig.json`),
911-
require: [],
912-
},
913913
},
914914
null,
915915
2

0 commit comments

Comments
 (0)