Skip to content

Commit

Permalink
refactor: test for side effects, and remove existing ones (#4769) (#4953
Browse files Browse the repository at this point in the history
)

* test: add test for side-effects

* refactor: remove toplevel property access
  • Loading branch information
filipesilva authored and benlesh committed Aug 7, 2019
1 parent b6eea10 commit 9829c5e
Show file tree
Hide file tree
Showing 32 changed files with 782 additions and 302 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
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
@@ -0,0 +1 @@
integration/side-effects/snapshots/
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -24,3 +24,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
@@ -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>.

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
@@ -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
@@ -0,0 +1 @@

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

7 changes: 7 additions & 0 deletions integration/side-effects/snapshots/esm2015/index.js
@@ -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
@@ -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
@@ -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/websocket.js
@@ -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
@@ -0,0 +1 @@
import "tslib";
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/fetch.js
@@ -0,0 +1 @@
import "tslib";
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/index.js
@@ -0,0 +1 @@
import "tslib";
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/operators.js
@@ -0,0 +1 @@
import "tslib";
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/testing.js
@@ -0,0 +1 @@
import "tslib";
1 change: 1 addition & 0 deletions integration/side-effects/snapshots/esm5/websocket.js
@@ -0,0 +1 @@
import "tslib";

0 comments on commit 9829c5e

Please sign in to comment.