Add test cases for non-stream field accesses and methods before and after pipe operations

This commit is contained in:
Napalys Klicius
2025-05-21 09:42:44 +02:00
parent 03d1f9a7d3
commit 5710f0cf51
3 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import * as rx from 'rxjs';
import * as ops from 'rxjs/operators';
const { of, from } = rx;
const { map, filter } = ops;
function f(){
of(1, 2, 3).pipe(map(x => x * 2)); // $SPURIOUS:Alert
someNonStream().pipe(map(x => x * 2)); // $SPURIOUS:Alert
}

View File

@@ -1,3 +1,5 @@
| rxjsStreams.js:8:3:8:35 | of(1, 2 ... x * 2)) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| rxjsStreams.js:9:3:9:39 | someNon ... x * 2)) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| 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. |
| 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. |
| 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. |
@@ -9,3 +11,18 @@
| test.js:116:5:116:21 | stream.pipe(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:125:5:125:26 | getStre ... e(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:143:5:143:62 | stream. ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:171:17:171:40 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:175:17:175:40 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:185:5:185:32 | copyStr ... nation) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:190:17:190:40 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:195:17:195:40 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:199:5:199:22 | notStream.pipe({}) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:203:5:203:26 | notStre ... ()=>{}) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:207:5:207:31 | getStre ... mber()) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:207:5:207:42 | getStre ... e(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:207:5:207:53 | getStre ... e(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:207:5:207:64 | getStre ... e(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:212:5:212:23 | getStream().pipe(p) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:212:5:212:34 | getStre ... e(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:212:5:212:45 | getStre ... e(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
| test.js:212:5:212:56 | getStre ... e(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |

View File

@@ -166,4 +166,49 @@ function test() {
const notStream = getNotAStream();
notStream.pipe(arg1, arg2, arg3);
}
{ // Member access on a non-stream after pipe
const notStream = getNotAStream();
const val = notStream.pipe(writable).someMember; // $SPURIOUS:Alert
}
{ // Member access on a stream after pipe
const notStream = getNotAStream();
const val = notStream.pipe(writable).readable; // $Alert
}
{ // Method access on a non-stream after pipe
const notStream = getNotAStream();
const val = notStream.pipe(writable).someMethod();
}
{ // Pipe on fs readStream
const fs = require('fs');
const stream = fs.createReadStream('file.txt');
const copyStream = stream;
copyStream.pipe(destination); // $Alert
}
{
const notStream = getNotAStream();
const something = notStream.someNotStreamPropertyAccess;
const val = notStream.pipe(writable); // $SPURIOUS:Alert
}
{
const notStream = getNotAStream();
const something = notStream.someNotStreamPropertyAccess();
const val = notStream.pipe(writable); // $SPURIOUS:Alert
}
{
const notStream = getNotAStream();
notStream.pipe({}); // $SPURIOUS:Alert
}
{
const notStream = getNotAStream();
notStream.pipe(()=>{}); // $SPURIOUS:Alert
}
{
const plumber = require('gulp-plumber');
getStream().pipe(plumber()).pipe(dest).pipe(dest).pipe(dest); // $SPURIOUS:Alert
}
{
const plumber = require('gulp-plumber');
const p = plumber();
getStream().pipe(p).pipe(dest).pipe(dest).pipe(dest); // $SPURIOUS:Alert
}
}