| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 73aa4e3 commit 67bbfeb
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -878,8 +878,14 @@ const common = { | |||
| 878 | 878 | throw new Error('common.PORT cannot be used in a parallelized test'); | |
| 879 | 879 | } | |
| 880 | 880 | return +process.env.NODE_COMMON_PORT || 12346; | |
| 881 | - } | ||
| 881 | + }, | ||
| 882 | 882 | ||
| 883 | + /** | ||
| 884 | + * Returns the EOL character used by this Git checkout. | ||
| 885 | + */ | ||
| 886 | + get checkoutEOL() { | ||
| 887 | + return fs.readFileSync(__filename).includes('\r\n') ? '\r\n' : '\n'; | ||
| 888 | + }, | ||
| 883 | 889 | }; | |
| 884 | 890 | ||
| 885 | 891 | const validProperties = new Set(Object.keys(common)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | - const { mustCall, isWindows } = require('../common'); | ||
| 3 | + const { mustCall, checkoutEOL } = require('../common'); | ||
| 4 | 4 | const fixtures = require('../common/fixtures'); | |
| 5 | 5 | const { spawn } = require('child_process'); | |
| 6 | 6 | const { strictEqual, ok } = require('assert'); | |
@@ -21,7 +21,7 @@ child.on('close', mustCall((code, signal) => { | |||
| 21 | 21 | stderr.includes( | |
| 22 | 22 | `[ERR_INVALID_PACKAGE_CONFIG]: Invalid package config ${invalidJson} ` + | |
| 23 | 23 | `while importing "invalid-pjson" from ${entry}. ` + | |
| 24 | - `Unexpected token } in JSON at position ${isWindows ? 16 : 14}` | ||
| 24 | + `Unexpected token } in JSON at position ${12 + checkoutEOL.length * 2}` | ||
| 25 | 25 | ), | |
| 26 | 26 | stderr); | |
| 27 | 27 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -250,7 +250,7 @@ function nextdir() { | |||
| 250 | 250 | 'istanbul-throw.js', | |
| 251 | 251 | coverageDirectory | |
| 252 | 252 | ); | |
| 253 | - if (common.isWindows) { | ||
| 253 | + if (common.checkoutEOL === '\r\n') { | ||
| 254 | 254 | assert.deepStrictEqual(sourceMap.lineLengths, [1086, 31, 185, 649, 0]); | |
| 255 | 255 | } else { | |
| 256 | 256 | assert.deepStrictEqual(sourceMap.lineLengths, [1085, 30, 184, 648, 0]); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ if (process.argv[2] === 'wasi-child') { | |||
| 34 | 34 | } else { | |
| 35 | 35 | const assert = require('assert'); | |
| 36 | 36 | const cp = require('child_process'); | |
| 37 | - const { EOL } = require('os'); | ||
| 37 | + const { checkoutEOL } = common; | ||
| 38 | 38 | ||
| 39 | 39 | function runWASI(options) { | |
| 40 | 40 | console.log('executing', options.test); | |
@@ -69,7 +69,7 @@ if (process.argv[2] === 'wasi-child') { | |||
| 69 | 69 | } | |
| 70 | 70 | runWASI({ test: 'exitcode', exitCode: 120 }); | |
| 71 | 71 | runWASI({ test: 'fd_prestat_get_refresh' }); | |
| 72 | - runWASI({ test: 'freopen', stdout: `hello from input2.txt${EOL}` }); | ||
| 72 | + runWASI({ test: 'freopen', stdout: `hello from input2.txt${checkoutEOL}` }); | ||
| 73 | 73 | runWASI({ test: 'ftruncate' }); | |
| 74 | 74 | runWASI({ test: 'getentropy' }); | |
| 75 | 75 | ||
@@ -87,10 +87,10 @@ if (process.argv[2] === 'wasi-child') { | |||
| 87 | 87 | runWASI({ test: 'readdir' }); | |
| 88 | 88 | } | |
| 89 | 89 | ||
| 90 | - runWASI({ test: 'read_file', stdout: `hello from input.txt${EOL}` }); | ||
| 90 | + runWASI({ test: 'read_file', stdout: `hello from input.txt${checkoutEOL}` }); | ||
| 91 | 91 | runWASI({ | |
| 92 | 92 | test: 'read_file_twice', | |
| 93 | - stdout: `hello from input.txt${EOL}hello from input.txt${EOL}` | ||
| 93 | + stdout: `hello from input.txt${checkoutEOL}hello from input.txt${checkoutEOL}` | ||
| 94 | 94 | }); | |
| 95 | 95 | runWASI({ test: 'stat' }); | |
| 96 | 96 | runWASI({ test: 'write_file' }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments