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 7727ba1

Browse filesBrowse files
silverwindrvagg
authored andcommitted
test: lint and refactor to avoid autocrlf issue
The test was failing after adding 'use strict' because the windows CI uses the autocrlf option of git which converts \r into \r\n on checkout. Refactored the test to not read itself anymore and create a temp file on the fly instead to avoid this line-ending issue. PR-URL: #2494 Reviewed-By: Joao Reis <reis@janeasystems.com>
1 parent f75d546 commit 7727ba1
Copy full SHA for 7727ba1

File tree

Expand file treeCollapse file tree

2 files changed

+20
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-14
lines changed
Open diff view settings
Collapse file

‎.eslintignore‎

Copy file name to clipboardExpand all lines: .eslintignore
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ lib/punycode.js
22
test/addons/doc-*/
33
test/fixtures
44
test/**/node_modules
5-
test/parallel/test-fs-non-number-arguments-throw.js
65
test/disabled
76
test/tmp*/
Collapse file
+20-13Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1-
var assert = require('assert'),
2-
fs = require('fs'),
3-
saneEmitter,
4-
sanity = 'ire(\'assert\')';
1+
'use strict';
52

6-
saneEmitter = fs.createReadStream(__filename, { start: 17, end: 29 });
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const fs = require('fs');
6+
const path = require('path');
7+
const tempFile = path.join(common.tmpDir, 'fs-non-number-arguments-throw');
78

8-
assert.throws(function () {
9-
fs.createReadStream(__filename, { start: "17", end: 29 });
9+
common.refreshTmpDir();
10+
fs.writeFileSync(tempFile, 'abc\ndef');
11+
12+
// a sanity check when using numbers instead of strings
13+
const sanity = 'def';
14+
const saneEmitter = fs.createReadStream(tempFile, { start: 4, end: 6 });
15+
16+
assert.throws(function() {
17+
fs.createReadStream(tempFile, { start: '4', end: 6 });
1018
}, "start as string didn't throw an error for createReadStream");
1119

12-
assert.throws(function () {
13-
fs.createReadStream(__filename, { start: 17, end: "29" });
20+
assert.throws(function() {
21+
fs.createReadStream(tempFile, { start: 4, end: '6' });
1422
}, "end as string didn't throw an error");
1523

16-
assert.throws(function () {
17-
fs.createWriteStream(__filename, { start: "17" });
24+
assert.throws(function() {
25+
fs.createWriteStream(tempFile, { start: '4' });
1826
}, "start as string didn't throw an error for createWriteStream");
1927

20-
saneEmitter.on('data', function (data) {
21-
// a sanity check when using numbers instead of strings
28+
saneEmitter.on('data', function(data) {
2229
assert.strictEqual(sanity, data.toString('utf8'), 'read ' +
2330
data.toString('utf8') + ' instead of ' + sanity);
2431
});

0 commit comments

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