| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5e731da commit 1f8eaec
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,6 +32,7 @@ const net = require('net'); | |||
| 32 | 32 | const path = require('path'); | |
| 33 | 33 | const { inspect } = require('util'); | |
| 34 | 34 | const { isMainThread } = require('worker_threads'); | |
| 35 | + const { isModuleNamespaceObject } = require('util/types'); | ||
| 35 | 36 | ||
| 36 | 37 | const tmpdir = require('./tmpdir'); | |
| 37 | 38 | const bits = ['arm64', 'loong64', 'mips', 'mipsel', 'ppc64', 'riscv64', 's390x', 'x64'] | |
@@ -938,6 +939,18 @@ function getPrintedStackTrace(stderr) { | |||
| 938 | 939 | return result; | |
| 939 | 940 | } | |
| 940 | 941 | ||
| 942 | + /** | ||
| 943 | + * Check the exports of require(esm). | ||
| 944 | + * TODO(joyeecheung): use it in all the test-require-module-* tests to minimize changes | ||
| 945 | + * if/when we change the layout of the result returned by require(esm). | ||
| 946 | + * @param {object} mod result returned by require() | ||
| 947 | + * @param {object} expectation shape of expected namespace. | ||
| 948 | + */ | ||
| 949 | + function expectRequiredModule(mod, expectation) { | ||
| 950 | + assert(isModuleNamespaceObject(mod)); | ||
| 951 | + assert.deepStrictEqual({ ...mod }, { ...expectation }); | ||
| 952 | + } | ||
| 953 | + | ||
| 941 | 954 | const common = { | |
| 942 | 955 | allowGlobals, | |
| 943 | 956 | buildType, | |
@@ -946,6 +959,7 @@ const common = { | |||
| 946 | 959 | createZeroFilledFile, | |
| 947 | 960 | defaultAutoSelectFamilyAttemptTimeout, | |
| 948 | 961 | expectsError, | |
| 962 | + expectRequiredModule, | ||
| 949 | 963 | expectWarning, | |
| 950 | 964 | gcUntil, | |
| 951 | 965 | getArrayBufferViews, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments