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

Chore/better testing #47

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { create, Environment, root } from './environment';
import Message, { MessageConstructor } from './message';
import ExecContext from './runtime/exec_context';
import StateManager from './runtime/state_manager';
import { mapResult, reduceUpdater } from './util';
import { log, mapResult, reduceUpdater } from './util';
import ViewWrapper from './view_wrapper';

/**
Expand Down Expand Up @@ -182,7 +182,7 @@ export const container: <M>(def: ContainerDef<M>) => Container<M> = withEnvironm
*/
export const isolate = <M>(ctr: Container<M>, opts: any = {}): IsolatedContainer<M> => {
const stateManager = opts.stateManager && always(opts.stateManager) || (() => new StateManager());
const env = create({ dispatcher: nthArg(2), effects: new Map(), log: () => {}, stateManager });
const env = create({ dispatcher: nthArg(2), effects: new Map(), log, stateManager });
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm fine with making this configurable through opts, but changing the default behavior is just going to create a bunch of console noise during testing.


const container = assign(mapDef(ctr.identity()), { accepts: always(true) }) as Container<M>;
const parent: any = opts.relay ? { relay: always(opts.relay) } : null;
Expand Down
2 changes: 1 addition & 1 deletion src/view_wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default class ViewWrapper<M> extends React.Component<ViewWrapperProps<M>,
this.execContext.destroy();
}

public unstable_handleError(e) {
public componentDidCatch(e) {
// tslint:disable-next-line:no-console
console.error('Failed to compile React component\n', e);
this.setState({ componentError: e });
Expand Down