Skip to content

Instantly share code, notes, and snippets.

@SamVerschueren
SamVerschueren / test.js
Created November 5, 2015 12:29
AVA time calculation
import test from 'ava';
import sinon from 'sinon';
let clock;
test('Before', t => {
clock = sinon.useFakeTimers(new Date(2015, 10, 10, 15, 15, 15).getTime());
t.end();
});

AVA is a JavaScript test runner that runs your tests concurrently and your files in parallel, giving you maximum speed (especially when dealing with IO!). Other features include built-in Babel (including async/await functions), test macros, watcher, TAP output, great assertion messages through power-assert. By the time of Reactive Conf we'll have even more great features.

My lightning talk would be an introduction to AVA and how it can benefit your React and Node testing with its speed, developer experience, and isolated processes. There'll be a lot of code and theory to explain why and how concurrency helps and how atomic tests make your life easier. It's a great project!

https://reactiveconf.com/

@SamVerschueren
SamVerschueren / index.ts
Last active August 25, 2016 19:56
index.ts
import * as objectAssign from 'object-assign';
const foo = {
foo: 'bar'
};
const unicorn = objectAssign({
unicorn: 'rainbow'
}, foo);
@SamVerschueren
SamVerschueren / concat.d.ts
Created August 25, 2016 20:23
concat.d.ts
declare module "concat" {
function concat(a: string, b: string): string;
export = concat;
}
@SamVerschueren
SamVerschueren / index.ts
Created August 25, 2016 20:27
concat example
import * as concat from 'concat';
console.log(concat('foo', 'bar'));
@SamVerschueren
SamVerschueren / index.ts
Created August 25, 2016 20:29
concat wrong example
import * as concat from 'concat';
console.log(concat('foo', 5));
@SamVerschueren
SamVerschueren / concat.d.ts
Created August 25, 2016 20:51
declare module
declare module "concat";
@SamVerschueren
SamVerschueren / index.es6.js
Created November 23, 2016 08:23
Mangling Name
class FooError extends Error {
constructor(message) {
super(message);
}
}
console.log(FooError.name);
module.exports = (message, queueName, options) => {
options = Object.assign({
awsAccountId: process.env.AWS_ACCOUNT_ID
}, options);
if (!message) {
return Promise.reject(new TypeError('Please provide a message'));
}
// All the rest
@SamVerschueren
SamVerschueren / license.js
Last active June 27, 2017 06:13
transformation function
'use strict';
const transform = pkg => {
pkg.license = 'MIT';
return pkg;
};
exports.transformations = [
{
transform,