File
Blob: src/workerd/api/node/tests/sys-nodejs-test.js
| 1 | // Copyright (c) 2024 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | import assert from 'node:assert'; |
| 5 | import module from 'node:module'; |
| 6 | |
| 7 | export const getBuiltinModule = { |
| 8 | async test() { |
| 9 | assert.deepStrictEqual( |
| 10 | process.getBuiltinModule('node:sys'), |
| 11 | process.getBuiltinModule('node:util') |
| 12 | ); |
| 13 | }, |
| 14 | }; |
| 15 | |
| 16 | export const canBeRequired = { |
| 17 | async test() { |
| 18 | const require = module.createRequire('/hello'); |
| 19 | assert.deepStrictEqual(require('node:sys'), require('node:util')); |
| 20 | assert.deepStrictEqual(require('sys'), require('node:util')); |
| 21 | }, |
| 22 | }; |
| 23 | |
| 24 | export const canBeImported = { |
| 25 | async test() { |
| 26 | const sys = await import('node:sys'); |
| 27 | const util = await import('node:util'); |
| 28 | assert.deepStrictEqual(sys, util); |
| 29 | }, |
| 30 | }; |