Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test for side effects, and remove existing ones #4769

Merged
merged 2 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
steps:
- attach_workspace: *attach_options
- run: npm test
- run: npm run test:side-effects

dtslint:
<<: *defaults
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
integration/side-effects/snapshots/
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ spec-build/
# Misc
npm-debug.log
.DS_STORE

# The check-side-effects package generates and deletes this file.
# If the process is killed, it will be left behind.
check-side-effects.tmp-input.js
9 changes: 9 additions & 0 deletions integration/side-effects/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This test checks if the side effects for loading RxJs packages have changed using <https://github.com/filipesilva/check-side-effects>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file explains how to use the side effect test.

Running `npm test:side-effects` will check all ES modules listed in `side-effects.json`.

Running `npm test:side-effects:update` will update any changed side effects.

To add a new ES module to this test, add a new entry in `side-effects.json`.

Usually the ESM and FESM should have the same output, but retained objects that were renamed during the flattening step will leave behind a different name.
52 changes: 52 additions & 0 deletions integration/side-effects/side-effects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"tests": [
{
"esModules": "../../dist/esm5/index.js",
"expectedOutput": "./snapshots/esm5/index.js"
},
{
"esModules": "../../dist/esm2015/index.js",
"expectedOutput": "./snapshots/esm2015/index.js"
},
{
"esModules": "../../dist/esm5/ajax/index.js",
"expectedOutput": "./snapshots/esm5/ajax.js"
},
{
"esModules": "../../dist/esm2015/ajax/index.js",
"expectedOutput": "./snapshots/esm2015/ajax.js"
},
{
"esModules": "../../dist/esm5/fetch/index.js",
"expectedOutput": "./snapshots/esm5/fetch.js"
},
{
"esModules": "../../dist/esm2015/fetch/index.js",
"expectedOutput": "./snapshots/esm2015/fetch.js"
},
{
"esModules": "../../dist/esm5/operators/index.js",
"expectedOutput": "./snapshots/esm5/operators.js"
},
{
"esModules": "../../dist/esm2015/operators/index.js",
"expectedOutput": "./snapshots/esm2015/operators.js"
},
{
"esModules": "../../dist/esm5/testing/index.js",
"expectedOutput": "./snapshots/esm5/testing.js"
},
{
"esModules": "../../dist/esm2015/testing/index.js",
"expectedOutput": "./snapshots/esm2015/testing.js"
},
{
"esModules": "../../dist/esm5/webSocket/index.js",
"expectedOutput": "./snapshots/esm5/websocket.js"
},
{
"esModules": "../../dist/esm2015/webSocket/index.js",
"expectedOutput": "./snapshots/esm2015/websocket.js"
}
]
}
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm2015/ajax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm2015/fetch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

7 changes: 7 additions & 0 deletions integration/side-effects/snapshots/esm2015/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var NotificationKind;

(function(NotificationKind) {
NotificationKind["NEXT"] = "N";
NotificationKind["ERROR"] = "E";
NotificationKind["COMPLETE"] = "C";
})(NotificationKind || (NotificationKind = {}));
7 changes: 7 additions & 0 deletions integration/side-effects/snapshots/esm2015/operators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var NotificationKind;

(function(NotificationKind) {
NotificationKind["NEXT"] = "N";
NotificationKind["ERROR"] = "E";
NotificationKind["COMPLETE"] = "C";
})(NotificationKind || (NotificationKind = {}));
7 changes: 7 additions & 0 deletions integration/side-effects/snapshots/esm2015/testing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var NotificationKind;

(function(NotificationKind) {
NotificationKind["NEXT"] = "N";
NotificationKind["ERROR"] = "E";
NotificationKind["COMPLETE"] = "C";
})(NotificationKind || (NotificationKind = {}));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is retained because of how TS transpiles enums. Newer versions of TS don't suffer from this.

7 changes: 7 additions & 0 deletions integration/side-effects/snapshots/esm2015/websocket.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var NotificationKind;

(function(NotificationKind) {
NotificationKind["NEXT"] = "N";
NotificationKind["ERROR"] = "E";
NotificationKind["COMPLETE"] = "C";
})(NotificationKind || (NotificationKind = {}));
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/ajax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "tslib";
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/fetch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "tslib";
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "tslib";
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/operators.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "tslib";
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/testing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "tslib";
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/websocket.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "tslib";
Loading