| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -321,7 +321,7 @@ ObjectDefineProperty(process, 'features', { | |||
| 321 | 321 | const { emitWarning, emitWarningSync } = require('internal/process/warning'); | |
| 322 | 322 | const { getOptionValue } = require('internal/options'); | |
| 323 | 323 | ||
| 324 | - let kTypeStrippingMode = null; | ||
| 324 | + let kTypeStrippingMode = process.config.variables.node_use_amaro ? null : false; | ||
| 325 | 325 | // This must be a getter, as getOptionValue does not work | |
| 326 | 326 | // before bootstrapping. | |
| 327 | 327 | ObjectDefineProperty(process.features, 'typescript', { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,31 @@ import * as fixtures from '../common/fixtures.mjs'; | |||
| 3 | 3 | import { match, strictEqual } from 'node:assert'; | |
| 4 | 4 | import { test } from 'node:test'; | |
| 5 | 5 | ||
| 6 | + test('expect process.features.typescript to be \'strip\' when --experimental-strip-types', async () => { | ||
| 7 | + const result = await spawnPromisified(process.execPath, [ | ||
| 8 | + '--no-warnings', | ||
| 9 | + '--experimental-strip-types', | ||
| 10 | + fixtures.path('typescript/echo-process-features-typescript.cjs'), | ||
| 11 | + ]); | ||
| 12 | + | ||
| 13 | + strictEqual(result.stderr, ''); | ||
| 14 | + strictEqual(result.stdout, process.config.variables.node_use_amaro ? 'strip\n' : 'false\n'); | ||
| 15 | + strictEqual(result.code, 0); | ||
| 16 | + }); | ||
| 17 | + | ||
| 18 | + test('expect process.features.typescript to be \'transform\' when --experimental-transform-types', async () => { | ||
| 19 | + const result = await spawnPromisified(process.execPath, [ | ||
| 20 | + '--no-warnings', | ||
| 21 | + '--experimental-transform-types', | ||
| 22 | + fixtures.path('typescript/echo-process-features-typescript.cjs'), | ||
| 23 | + ]); | ||
| 24 | + | ||
| 25 | + strictEqual(result.stderr, ''); | ||
| 26 | + strictEqual(result.stdout, process.config.variables.node_use_amaro ? 'transform\n' : 'false\n'); | ||
| 27 | + strictEqual(result.code, 0); | ||
| 28 | + }); | ||
| 29 | + | ||
| 30 | + | ||
| 6 | 31 | if (!process.config.variables.node_use_amaro) skip('Requires Amaro'); | |
| 7 | 32 | ||
| 8 | 33 | test('execute a TypeScript file', async () => { | |
@@ -354,30 +379,6 @@ test('execute a TypeScript test mocking module', { skip: isWindows && process.ar | |||
| 354 | 379 | strictEqual(result.code, 0); | |
| 355 | 380 | }); | |
| 356 | 381 | ||
| 357 | - test('expect process.features.typescript to be \'strip\' when --experimental-strip-types', async () => { | ||
| 358 | - const result = await spawnPromisified(process.execPath, [ | ||
| 359 | - '--no-warnings', | ||
| 360 | - '--experimental-strip-types', | ||
| 361 | - '-p', 'process.features.typescript', | ||
| 362 | - ]); | ||
| 363 | - | ||
| 364 | - strictEqual(result.stderr, ''); | ||
| 365 | - strictEqual(result.stdout, 'strip\n'); | ||
| 366 | - strictEqual(result.code, 0); | ||
| 367 | - }); | ||
| 368 | - | ||
| 369 | - test('expect process.features.typescript to be \'transform\' when --experimental-transform-types', async () => { | ||
| 370 | - const result = await spawnPromisified(process.execPath, [ | ||
| 371 | - '--no-warnings', | ||
| 372 | - '--experimental-transform-types', | ||
| 373 | - '-p', 'process.features.typescript', | ||
| 374 | - ]); | ||
| 375 | - | ||
| 376 | - strictEqual(result.stderr, ''); | ||
| 377 | - strictEqual(result.stdout, 'transform\n'); | ||
| 378 | - strictEqual(result.code, 0); | ||
| 379 | - }); | ||
| 380 | - | ||
| 381 | 382 | test('expect process.features.typescript to be false without type-stripping', async () => { | |
| 382 | 383 | strictEqual(process.features.typescript, false); | |
| 383 | 384 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + console.log(process.features.typescript); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments