Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign uptest(docs-infra): draft to ensure that everything is setup properly t… #34190
Conversation
48592a0
to
b1fcd71
This comment has been minimized.
This comment has been minimized.
|
@gkalpak Please review. The assumption is that the step to run the stand-alone tests runs after the e2e tests have run. This will ensure that the |
b1fcd71
to
dff4783
This comment has been minimized.
This comment has been minimized.
|
This lgtm for now. We will re-work it the infrastructure, before the merging the PR, but this is good enough for now so that you can keep working on the actual tests. Thx for sorting it out |
acf8db2
to
2e3651b
2e3651b
to
747e9d0
This comment has been minimized.
This comment has been minimized.
|
As discussed "offline", here are my thoughts (and suggestions for next steps):
So, given the above, I think a good solution ("good" in the sense that it is fairly simple, will not take a lot of time to implement infrastructure for and will allow us to focus on tests (which is the primary focus for now)) would be the following:
As an example, here is what a code snippet could look like before my suggested change: // #docregion foo
const elem = document.querySelector('foo');
const subscription = fromEvent(elem, 'click').subscribe(() => console.log('*click*'));
setTimeout(() => subscription.unsubscribe(), 10000);
// #enddocregion fooAnd here is how it would be transformed with my suggestion: // By wrapping a function around the code, we make it "lazy"
// (i.e. it won't be executed immediately).
//
// We can pass in "globals" (in TS we can give them proper types).
// Here for example, we can pass in a mock `console` to capture the logs.
// (We could even pass a mock `setTimeout()`, but that is unnecessary,
// since we can mock that with `jasmine.clock().install()` etc.)
export function docregionFoo(console, document) {
// The code-snippet that the user will see remains unchanged.
// (The indentation might change, but that is fine.)
// #docregion foo
const elem = document.querySelector('foo');
const subscription = fromEvent(elem, 'click').subscribe(() => console.log('*click*'));
setTimeout(() => subscription.unsubscribe(), 10000);
// #enddocregion foo
// Here, return the `subscription`, if we need to run assertions against it.
return subscription;
} |
…back


sonukapoor commentedDec 2, 2019
…o run tests
against the Rx-JS examples
Addresses #28017
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information