Skip to content

Instantly share code, notes, and snippets.

Yaroslav Kovalev yesley

Block or report user

Report or block yesley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yesley
yesley / webpack.config.js
Last active Oct 17, 2018
Storybook + Babel@7
View webpack.config.js
// .storybook/webpack.config.js
// source: https://github.com/storybooks/storybook/issues/3843#issuecomment-409322505
module.exports = (baseConfig, env, defaultConfig) => {
// this is how storybook shows to do it in their docs so it has to be reassigned
// add support for `.js`, `.mjs`, `.jsx` and `.json`
defaultConfig.module.rules[0].test = /\.(m?jsx?|json)$/;
defaultConfig.resolve.extensions = ['.js', '.jsx', '.mjs', '.json'];
// use @babel/preset-react instead of storybook config
View promises.js
// This two functions return promises
const foo = val => new Promise((resolve, reject) => {
if (val === 0) { reject(new Error('Some shit went wrong')); }
resolve(val + 1);
});
const baz = param => new Promise((resolve, reject) => {
if (param == null) { reject(new Error('This shit isn\'t working')); }
resolve(param.fieldName);
});
@yesley
yesley / karma.conf.js
Last active Feb 21, 2018
ES6 + Babel + Browserify + Mocha + Chai + Karma + Istanbul + PhantomJS
View karma.conf.js
var istanbul = require('browserify-istanbul');
module.exports = function (config) {
config.set({
basePath: '../',
files: ['src/scripts/**/*.js', 'test/unit/**/*.js'],
frameworks: ['browserify', 'mocha', 'chai'],
browsers: ['PhantomJS'], // 'Chrome'
You can’t perform that action at this time.