-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Detect RxJS 7 correctly - Patch Observable of RxJS >=7.2.0 correctly - Runs integration tests with multiple RxJS versions Closes #52
- Loading branch information
Showing
7 changed files
with
72 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import isRxJSImport from './isRxJSImport'; | ||
|
||
describe('Runtime', () => { | ||
describe('isRxJSImport()', () => { | ||
test.each([ | ||
[true, '/node_modules/rxjs/dist/esm5/internal/Observable.js'], | ||
[true, '/node_modules/rxjs/dist/esm5/internal/Observable'], | ||
[true, '/node_modules/rxjs/esm5/internal/Observable.js'], | ||
[true, '/node_modules/rxjs/esm5/internal/Observable'], | ||
[true, '/node_modules/rxjs/_esm5/internal/Observable.js'], | ||
[true, '/node_modules/rxjs/_esm5/internal/Observable'], | ||
[true, '/node_modules/rxjs/_esm2015/internal/Observable.js'], | ||
[true, '/node_modules/rxjs/_esm2015/internal/Observable'], | ||
[true, '/node_modules/rxjs/internal/Observable.js'], | ||
[true, '/node_modules/rxjs/internal/Observable'], | ||
[true, 'rxjs/internal/Observable'], | ||
[false, 'rxjs'], | ||
[false, 'rxjs/Observable'], | ||
[false, 'Observable'], | ||
[false, ''], | ||
])('returns %s for %s', (expected, path) => { | ||
expect(isRxJSImport(path)).toBe(expected); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const OBSERVABLE_MODULE_REGEX = /rxjs\/(dist\/|esm\/|esm5\/|_esm5\/|_esm2015\/|cjs\/)*internal\/Observable(\.js)?$/; | ||
|
||
/** | ||
* Tests if a given path is leads to RxJS' `Observable.js` file. | ||
* | ||
* @param path | ||
* @returns | ||
*/ | ||
export default function isRxJSImport(path: string): boolean { | ||
const match = OBSERVABLE_MODULE_REGEX.exec(path); | ||
return match !== null; | ||
} |