Skip to content

Instantly share code, notes, and snippets.

@fkling
Created July 1, 2014 15:10
Show Gist options
  • Save fkling/e954b3ecc79a3620df09 to your computer and use it in GitHub Desktop.
Save fkling/e954b3ecc79a3620df09 to your computer and use it in GitHub Desktop.
recast + jest-cli errors
fkling@Felixs-iMac ~/D/p/es6-forof> jest
Using Jest CLI v0.1.16
Found 1 matching tests...
FAIL __tests__/es6forof-test.js (0.166s)
Before parse
After parse
Before print
● es6-forof transform › it handles source
- Throws: AssertionError: false == true
1 tests failed, 0 tests passed (1 total)
Run time: 0.726s
"use strict";
jest.autoMockOff();
var transform = require('../');
describe('es6-forof transform', function() {
it('handles source', function() {
var code = transform('console.log(1);');
expect(function() {
eval(code);
}).not.toThrow();
});
});
'use strict';
var recast = require('recast');
function es6_forof(source) {
console.log('Before parse');
source = recast.parse(source);
console.log('After parse');
console.log('Before print');
source = recast.print(source).code;
console.log('After print');
return source;
}
module.exports = es6_forof;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment