Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e654c8b

Browse filesBrowse files
jasnelladuh95
authored andcommitted
test: simplify common/index.js
Move single or trivial and limited use things out of common/index.js for the purpose of simplifying and reducing common/index.js PR-URL: #56712 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 58d2dad commit e654c8b
Copy full SHA for e654c8b

File tree

Expand file treeCollapse file tree

6 files changed

+19
-28
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+19
-28
lines changed
Open diff view settings
Collapse file

‎test/common/README.md‎

Copy file name to clipboardExpand all lines: test/common/README.md
-6Lines changed: 0 additions & 6 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,6 @@ Platform check for IBMi.
279279

280280
Platform check for Linux.
281281

282-
### `isLinuxPPCBE`
283-
284-
* [\<boolean>][<boolean>]
285-
286-
Platform check for Linux on PowerPC.
287-
288282
### `isMacOS`
289283

290284
* [\<boolean>][<boolean>]
Collapse file

‎test/common/index.js‎

Copy file name to clipboardExpand all lines: test/common/index.js
-12Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,11 +1034,6 @@ const common = {
10341034
return require('os').type() === 'OS400';
10351035
},
10361036

1037-
get isLinuxPPCBE() {
1038-
return (process.platform === 'linux') && (process.arch === 'ppc64') &&
1039-
(require('os').endianness() === 'BE');
1040-
},
1041-
10421037
get localhostIPv4() {
10431038
if (localhostIPv4 !== null) return localhostIPv4;
10441039

@@ -1067,13 +1062,6 @@ const common = {
10671062
return +process.env.NODE_COMMON_PORT || 12346;
10681063
},
10691064

1070-
/**
1071-
* Returns the EOL character used by this Git checkout.
1072-
*/
1073-
get checkoutEOL() {
1074-
return fs.readFileSync(__filename).includes('\r\n') ? '\r\n' : '\n';
1075-
},
1076-
10771065
get isInsideDirWithUnusualChars() {
10781066
return __dirname.includes('%') ||
10791067
(!isWindows && __dirname.includes('\\')) ||
Collapse file

‎test/common/index.mjs‎

Copy file name to clipboardExpand all lines: test/common/index.mjs
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const {
77
allowGlobals,
88
buildType,
99
canCreateSymLink,
10-
checkoutEOL,
1110
childShouldThrowAndAbort,
1211
createZeroFilledFile,
1312
enoughTestMem,
@@ -27,7 +26,6 @@ const {
2726
isIBMi,
2827
isInsideDirWithUnusualChars,
2928
isLinux,
30-
isLinuxPPCBE,
3129
isMainThread,
3230
isOpenBSD,
3331
isMacOS,
@@ -59,7 +57,6 @@ export {
5957
allowGlobals,
6058
buildType,
6159
canCreateSymLink,
62-
checkoutEOL,
6360
childShouldThrowAndAbort,
6461
createRequire,
6562
createZeroFilledFile,
@@ -81,7 +78,6 @@ export {
8178
isIBMi,
8279
isInsideDirWithUnusualChars,
8380
isLinux,
84-
isLinuxPPCBE,
8581
isMainThread,
8682
isOpenBSD,
8783
isMacOS,
Collapse file

‎test/parallel/test-source-map-enable.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-source-map-enable.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ function nextdir() {
242242

243243
// Persists line lengths for in-memory representation of source file.
244244
{
245+
const checkoutEOL = fs.readFileSync(__filename).includes('\r\n') ? '\r\n' : '\n';
245246
const coverageDirectory = nextdir();
246247
spawnSync(process.execPath, [
247248
require.resolve('../fixtures/source-map/istanbul-throw.js'),
@@ -250,7 +251,7 @@ function nextdir() {
250251
'istanbul-throw.js',
251252
coverageDirectory
252253
);
253-
if (common.checkoutEOL === '\r\n') {
254+
if (checkoutEOL === '\r\n') {
254255
assert.deepStrictEqual(sourceMap.lineLengths, [1086, 31, 185, 649, 0]);
255256
} else {
256257
assert.deepStrictEqual(sourceMap.lineLengths, [1085, 30, 184, 648, 0]);
Collapse file

‎test/tick-processor/util.js‎

Copy file name to clipboardExpand all lines: test/tick-processor/util.js
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@ const {
55
isWindows,
66
isSunOS,
77
isAIX,
8-
isLinuxPPCBE,
98
isFreeBSD,
109
} = require('../common');
1110

11+
const { endianness } = require('os');
12+
13+
function isLinuxPPCBE() {
14+
return (process.platform === 'linux') &&
15+
(process.arch === 'ppc64') &&
16+
(endianness() === 'BE');
17+
}
18+
1219
module.exports = {
1320
isCPPSymbolsNotMapped: isWindows ||
1421
isSunOS ||
1522
isAIX ||
16-
isLinuxPPCBE ||
23+
isLinuxPPCBE() ||
1724
isFreeBSD,
1825
};
Collapse file

‎test/wasi/test-wasi-io.js‎

Copy file name to clipboard
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
'use strict';
2-
const common = require('../common');
3-
const { checkoutEOL } = common;
2+
require('../common');
3+
const { readFileSync } = require('fs');
44
const { testWasiPreview1 } = require('../common/wasi');
55

6+
const checkoutEOL = readFileSync(__filename).includes('\r\n') ? '\r\n' : '\n';
7+
8+
// TODO(@jasnell): It's not entirely clear what this test is asserting.
9+
// More comments would be helpful.
10+
611
testWasiPreview1(['freopen'], {}, { stdout: `hello from input2.txt${checkoutEOL}` });
712
testWasiPreview1(['read_file'], {}, { stdout: `hello from input.txt${checkoutEOL}` });
813
testWasiPreview1(['read_file_twice'], {}, {
914
stdout: `hello from input.txt${checkoutEOL}hello from input.txt${checkoutEOL}`,
1015
});
1116
// Tests that are currently unsupported on Windows.
12-
if (!common.isWindows) {
17+
if (process.platform !== 'win32') {
1318
testWasiPreview1(['stdin'], { input: 'hello world' }, { stdout: 'hello world' });
1419
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.