|
1 | 1 | import { context, ExecutionContext } from './testlib';
|
2 | 2 | import * as expect from 'expect';
|
3 | 3 | import { join, resolve, sep as pathSep } from 'path';
|
4 |
| -import semver = require('semver'); |
5 |
| -import { project as fsProject } from '@TypeStrong/fs-fixture-builder'; |
6 | 4 | import {
|
7 | 5 | BIN_PATH_JS,
|
8 | 6 | CMD_TS_NODE_WITH_PROJECT_TRANSPILE_ONLY_FLAG,
|
9 |
| - ctxTmpDirOutsideCheckout, |
10 | 7 | ts,
|
11 |
| - tsSupportsEs2021, |
12 |
| - tsSupportsEs2022, |
13 | 8 | tsSupportsMtsCtsExtensions,
|
14 | 9 | tsSupportsStableNodeNextNode16,
|
15 | 10 | } from './helpers';
|
@@ -571,84 +566,6 @@ test.suite('ts-node', (test) => {
|
571 | 566 | expect(r.stderr).toBe('');
|
572 | 567 | });
|
573 | 568 |
|
574 |
| - test.suite( |
575 |
| - 'should use implicit @tsconfig/bases config when one is not loaded from disk', |
576 |
| - ({ contextEach }) => { |
577 |
| - const test = contextEach(ctxTmpDirOutsideCheckout); |
578 |
| - const libAndTarget = |
579 |
| - semver.gte(process.versions.node, '18.0.0') && tsSupportsEs2022 |
580 |
| - ? 'es2022' |
581 |
| - : semver.gte(process.versions.node, '16.0.0') && tsSupportsEs2021 |
582 |
| - ? 'es2021' |
583 |
| - : 'es2020'; |
584 |
| - test('implicitly uses @tsconfig/node14, @tsconfig/node16, or @tsconfig/node18 compilerOptions when both TS and node versions support it', async (t) => { |
585 |
| - const r1 = await exec(`${BIN_PATH} --showConfig`, { |
586 |
| - cwd: t.context.tmpDir, |
587 |
| - }); |
588 |
| - expect(r1.err).toBe(null); |
589 |
| - t.like(JSON.parse(r1.stdout), { |
590 |
| - compilerOptions: { |
591 |
| - target: libAndTarget, |
592 |
| - lib: [libAndTarget], |
593 |
| - }, |
594 |
| - }); |
595 |
| - const r2 = await exec(`${BIN_PATH} -pe 10n`, { |
596 |
| - cwd: t.context.tmpDir, |
597 |
| - }); |
598 |
| - expect(r2.err).toBe(null); |
599 |
| - expect(r2.stdout).toBe('10n\n'); |
600 |
| - }); |
601 |
| - test('implicitly loads @types/node even when not installed within local directory', async (t) => { |
602 |
| - const r = await exec(`${BIN_PATH} -pe process.env.foo`, { |
603 |
| - cwd: t.context.tmpDir, |
604 |
| - env: { ...process.env, foo: 'hello world' }, |
605 |
| - }); |
606 |
| - expect(r.err).toBe(null); |
607 |
| - expect(r.stdout).toBe('hello world\n'); |
608 |
| - }); |
609 |
| - test('implicitly loads local @types/node', async (t) => { |
610 |
| - t.context.fixture.readFrom( |
611 |
| - join(TEST_DIR, 'local-types-node'), |
612 |
| - undefined, |
613 |
| - [] |
614 |
| - ); |
615 |
| - t.context.fixture.write(); |
616 |
| - const r = await exec(`${BIN_PATH} -pe process.env.foo`, { |
617 |
| - cwd: t.context.fixture.cwd, |
618 |
| - env: { ...process.env, foo: 'hello world' }, |
619 |
| - }); |
620 |
| - expect(r.err).not.toBe(null); |
621 |
| - expect(r.stderr).toMatch( |
622 |
| - "Property 'env' does not exist on type 'LocalNodeTypes_Process'" |
623 |
| - ); |
624 |
| - }); |
625 |
| - } |
626 |
| - ); |
627 |
| - |
628 |
| - test.suite( |
629 |
| - 'should bundle @tsconfig/bases to be used in your own tsconfigs', |
630 |
| - (test) => { |
631 |
| - // Older TS versions will complain about newer `target` and `lib` options |
632 |
| - test.if(tsSupportsEs2022); |
633 |
| - const macro = test.macro((nodeVersion: string) => async (t) => { |
634 |
| - const config = require(`@tsconfig/${nodeVersion}/tsconfig.json`); |
635 |
| - const r = await exec(`${BIN_PATH} --showConfig -e 10n`, { |
636 |
| - cwd: join(TEST_DIR, 'tsconfig-bases', nodeVersion), |
637 |
| - }); |
638 |
| - expect(r.err).toBe(null); |
639 |
| - t.like(JSON.parse(r.stdout), { |
640 |
| - compilerOptions: { |
641 |
| - target: config.compilerOptions.target, |
642 |
| - lib: config.compilerOptions.lib, |
643 |
| - }, |
644 |
| - }); |
645 |
| - }); |
646 |
| - test(`ts-node/node14/tsconfig.json`, macro, 'node14'); |
647 |
| - test(`ts-node/node16/tsconfig.json`, macro, 'node16'); |
648 |
| - test(`ts-node/node18/tsconfig.json`, macro, 'node18'); |
649 |
| - } |
650 |
| - ); |
651 |
| - |
652 | 569 | test.suite('compiler host', (test) => {
|
653 | 570 | test('should execute cli', async () => {
|
654 | 571 | const r = await exec(
|
|
0 commit comments