| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ceb1d5e commit 5d03f6f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -737,6 +737,19 @@ describe('Loader hooks', { concurrency: true }, () => { | |||
| 737 | 737 | assert.strictEqual(signal, null); | |
| 738 | 738 | }); | |
| 739 | 739 | ||
| 740 | + describe('should use hooks', async () => { | ||
| 741 | + const { code, signal, stdout, stderr } = await spawnPromisified(process.execPath, [ | ||
| 742 | + '--import', | ||
| 743 | + fixtures.fileURL('es-module-loaders/builtin-named-exports.mjs'), | ||
| 744 | + fixtures.path('es-modules/require-esm-throws-with-loaders.js'), | ||
| 745 | + ]); | ||
| 746 | + | ||
| 747 | + assert.strictEqual(stderr, ''); | ||
| 748 | + assert.strictEqual(stdout, ''); | ||
| 749 | + assert.strictEqual(code, 0); | ||
| 750 | + assert.strictEqual(signal, null); | ||
| 751 | + }); | ||
| 752 | + | ||
| 740 | 753 | it('should support source maps in commonjs translator', async () => { | |
| 741 | 754 | const readFile = async () => {}; | |
| 742 | 755 | const hook = ` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,8 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const { readFile, __fromLoader } = require('fs'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + | ||
| 5 | + assert.throws(() => require('./test-esm-ok.mjs'), { code: 'ERR_REQUIRE_ESM' }); | ||
| 6 | + | ||
| 7 | + assert(readFile); | ||
| 8 | + assert(__fromLoader); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments