Skip to content

Instantly share code, notes, and snippets.

View devenbansod's full-sized avatar

Deven Bansod devenbansod

View GitHub Profile
@devenbansod
devenbansod / matcher.diff
Created March 16, 2018 05:22
Added a matcher to match TypeAnnotations
diff --git a/packages/babel-traverse/test/inference.js b/packages/babel-traverse/test/inference.js
index 1cc499d0c..c92c89ad0 100644
--- a/packages/babel-traverse/test/inference.js
+++ b/packages/babel-traverse/test/inference.js
@@ -2,6 +2,26 @@ import traverse from "../lib";
import { parse } from "babylon";
import * as t from "@babel/types";
+expect.extend({
+ toBeAnnotationOfType(received, expectedType) {
@devenbansod
devenbansod / errors.md
Created March 7, 2018 16:12
Errors while running parse.js tests

First error

FAIL packages/babel-core/test/parse.js ● parse › should parse using configuration from .babelrc when a filename is provided

expect(received).toEqual(expected)

Expected value to equal:

{"comments": [], "end": 91, "loc": {"end": {"column": 0, "line": 7}, "start": {"column": 0, "line": 1}}, "program": {"body": [{"body": {"body": [], "end": 29, "loc": {"end": {"column": 17, "line": 2}, "start": {"column": 14, "line": 2}}, "start": 26, "type": "ClassBody"}, "decorators": [{"end": 11, "expression": {"end": 11, "loc": {"end": {"column": 11, "line": 1}, "identifierName": "annotation", "start": {"column": 1, "line": 1}}, "name": "annotation", "start": 1, "type": "Identifier"}, "loc": {"end": {"column": 11, "line": 1}, "start": {"column": 0, "line": 1}}, "start": 0, "type": "Decorator"}], "end": 29, "id": {"end": 25, "loc": {"end": {"column": 13, "line": 2}, "identifierName": "MyClass", "start": {"column": 6, "line": 2}}, "name": "MyClass", "start": 18, "type": "Identifier"}, "loc"

@devenbansod
devenbansod / transformAssert.js
Last active March 8, 2018 08:18
Transformations to convert some basic assert.* functions to Jest expect
const functionsToBeTransformed = [ 'ok', 'equal', 'deepEqual', 'notEqual', 'throws', 'strictEqual' ];
const getParams = (propertyName, args) => {
switch (propertyName) {
case 'ok': return {
arguments1: [args[0]],
identifier2: 'toBeTruthy',
arguments2: []
};

Keybase proof

I hereby claim:

  • I am devenbansod on github.
  • I am devenbansod (https://keybase.io/devenbansod) on keybase.
  • I have a public key whose fingerprint is 752F A923 0C20 76B4 432A CDAB 27FA 1EE4 35E3 C96A

To claim this, I am signing this object: