Skip to content

Instantly share code, notes, and snippets.

@pablopaul
pablopaul / codecept.conf.js
Last active Nov 26, 2018
CodeceptJS 1.4.6. Debug White Page Failure - To see the logged page source run your tests with "--verbose"
View codecept.conf.js
// Add the plugin to the CodeceptJS config
...
plugins: {
logPageSource: {
require: "./logPageSource",
enabled: true
}
}
@pablopaul
pablopaul / testing-react-components.js
Last active Apr 18, 2018 — forked from peduarte/testing-react-components.txt
Fix "ReferenceError: document is not defined" in jsdom + enzyme + ava environment.
View testing-react-components.js
/*
* Step 1
*/
npm install --save-dev jsdom
/*
* Step 2 (http://airbnb.io/enzyme/docs/guides/jsdom.html)
*
* test-browser-env.js
@pablopaul
pablopaul / deploy.rb
Last active Feb 5, 2019 — forked from cannikin/deploy.rb
Notify Sentry of a new release via Capistrano with Auth Token
View deploy.rb
# This task will notify Sentry via their API[1] that you have deployed
# a new release. It uses the release timestamp as the `version`
# (like 20151113182847) and the git ref as the optional `ref` value.
#
# This task requires several environment variables be set (or just
# hardcode the values in here if you like living on the edge):
#
# ENV['SENTRY_API_ENDPOINT'] : API endpoint, https://app.getsentry.com
# ENV['SENTRY_ORG'] : the organization for this app
# ENV['SENTRY_PROJECT'] : the project for this app
View redux-store-unsubscribe.js
unsubscribe();
// Nothing is logged
store.dispatch(insertCharacter('z'));
View redux-store-subscriber-demo.js
// Logs 'x'
store.dispatch(insertCharacter('x'));
// Logs 'xy'
store.dispatch(insertCharacter('y'));
// `removeCharacter` is an action creator wrapping the `BACKSPACE` action
// Logs 'x'
store.dispatch(removeCharacter());
// Logs ''
store.dispatch(removeCharacter());
View redux-store-subscribe.js
const unsubscribe = store.subscribe( () => console.log( store.getState() ) );
View redux-store-getstate.js
const state = store.getState();
// Logs 'x'
console.log(state);
View redux-store-dispatch-action.js
store.dispatch(
{
type: 'CHARACTER_TYPED',
char: 'x'
}
);
You can’t perform that action at this time.