-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2859 from cloudflare/yagiz/add-node-sys
add node:sys to comply with nodejs_compat
- Loading branch information
Showing
4 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import assert from 'node:assert'; | ||
import module from 'node:module'; | ||
|
||
export const getBuiltinModule = { | ||
async test() { | ||
assert.deepStrictEqual( | ||
process.getBuiltinModule('node:sys'), | ||
process.getBuiltinModule('node:util') | ||
); | ||
}, | ||
}; | ||
|
||
export const canBeRequired = { | ||
async test() { | ||
const require = module.createRequire('/hello'); | ||
assert.deepStrictEqual(require('node:sys'), require('node:util')); | ||
assert.deepStrictEqual(require('sys'), require('node:util')); | ||
}, | ||
}; | ||
|
||
export const canBeImported = { | ||
async test() { | ||
const sys = await import('node:sys'); | ||
const util = await import('node:util'); | ||
assert.deepStrictEqual(sys, util); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Workerd = import "/workerd/workerd.capnp"; | ||
|
||
const unitTests :Workerd.Config = ( | ||
services = [ | ||
( name = "nodejs-sys-test", | ||
worker = ( | ||
modules = [ | ||
(name = "worker", esModule = embed "sys-nodejs-test.js") | ||
], | ||
compatibilityDate = "2024-09-23", | ||
compatibilityFlags = ["nodejs_compat"], | ||
) | ||
), | ||
], | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters