Skip to content

Commit 15ff7cb

Browse files
committed
Added more test cases which common js libraries uses .pipe()
1 parent b10a948 commit 15ff7cb

File tree

5 files changed

+29
-1
lines changed

5 files changed

+29
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { type } from 'arktype';
2+
3+
type.string.pipe(Number) // $SPURIOUS:Alert
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const execa = require('execa');
2+
3+
(async () => {
4+
const first = execa('node', ['empty.js']);
5+
const second = execa('node', ['stdin.js']);
6+
7+
first.stdout.pipe(second.stdin); // $SPURIOUS:Alert
8+
9+
const {stdout} = await second;
10+
console.log(stdout);
11+
})();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const highland = require('highland');
2+
const fs = require('fs');
3+
4+
highland(fs.createReadStream('input.txt'))
5+
.map(line => {
6+
if (line.length === 0) throw new Error('Empty line');
7+
return line;
8+
}).pipe(fs.createWriteStream('output.txt')); // $SPURIOUS:Alert

javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/rxjsStreams.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as rx from 'rxjs';
22
import * as ops from 'rxjs/operators';
33
import { TestScheduler } from 'rxjs/testing';
4-
4+
import { pluck } from "rxjs/operators/pluck";
55

66
const { of, from } = rx;
77
const { map, filter } = ops;
@@ -15,4 +15,6 @@ function f(){
1515
const source = x('', {o: [a, b, c]});
1616
z(source.pipe(null)).toBe(expected,y,);
1717
});
18+
19+
z.option$.pipe(pluck("x")) // $SPURIOUS:Alert
1820
}

javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/test.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
| arktype.js:3:1:3:24 | type.st ... Number) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
2+
| execa.js:7:3:7:33 | first.s ... .stdin) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
3+
| highland.js:4:1:8:45 | highlan ... .txt')) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
4+
| rxjsStreams.js:19:3:19:28 | z.optio ... k("x")) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
15
| test.js:4:5:4:28 | stream. ... nation) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
26
| test.js:19:5:19:17 | s2.pipe(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
37
| test.js:45:5:45:30 | stream2 ... ation2) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |

0 commit comments

Comments
 (0)