nodejs/test/module-hooks/test-module-hooks-resolve-load-require-inline-typescript-override.js
Joyee Cheung e85964610c module: implement module.registerHooks()
PR-URL: https://github.com/nodejs/node/pull/55698
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
2024-12-09 23:27:08 +00:00

14 lines
645 B
JavaScript

'use strict';
// Flags: --experimental-strip-types --no-experimental-transform-types
// This tests that a mini TypeScript loader works with resolve and
// load hooks when overriding --experimental-strip-types in CJS.
require('../common');
const assert = require('assert');
require('../fixtures/module-hooks/register-typescript-hooks.js');
// Test inline require(), if override fails, this should fail too because enum is
// not supported when --experimental-transform-types is disabled.
const { UserAccount, UserType } = require('../fixtures/module-hooks/user.ts');
assert.strictEqual((new UserAccount('foo', 1, UserType.Admin).name), 'foo');