Skip to content

Commit 3cd59e6

Browse files
committed
test: ignore os specific constants
1 parent abad8c8 commit 3cd59e6

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

test/node-coverage.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ for (const module of builtinModules) {
1818
const unenvMod = await import(`../src/runtime/node/${module}.ts`);
1919

2020
const supportedExports = [] as string[];
21-
const unsupportedExports = [] as string[];
22-
const extraExports = [] as string[];
21+
let unsupportedExports = [] as string[];
22+
let extraExports = [] as string[];
2323

2424
// Make sure named exports are covered
2525
for (const exportName of Object.getOwnPropertyNames(nodeMod)) {
@@ -71,6 +71,21 @@ for (const module of builtinModules) {
7171
}
7272
}
7373

74+
if (module === 'constants') {
75+
// TODO: Should we remove this always?
76+
const osConstants = [
77+
// not availablein macos
78+
'O_SYMLINK',
79+
'SIGINFO',
80+
// macos specific
81+
'O_DIRECT',
82+
'O_NOATIME'
83+
]
84+
const isOsSpecific = (name: string) => name => !osConstants.find(c => name === c || name === `default.${c}`)
85+
unsupportedExports = unsupportedExports.filter(name => !isOsSpecific(name))
86+
extraExports = unsupportedExports.filter(name => !isOsSpecific(name))
87+
}
88+
7489
modulesCoverage.push({
7590
name: module,
7691
supportedExports,

0 commit comments

Comments
 (0)