Skip to content

Instantly share code, notes, and snippets.

// build/modules/Application.js
module.exports = function() { console.log('hai!'); };
runner: 970 tests. 8 failures. 507 ms
function* t() {}: Expected
{
"type": "Program",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "t",
// __tests__/Foo-test.js
describe('hai', function() {
it('asdf', function() {
console.log('requireing r.js..');
require('../r');
});
});
// __tests__/Foo-test.js
describe('hai', function() {
it('asdf', function() {
var mockedImplWithReturn = jest.genMockFn().mockImpl(function() {
console.log(' running impl');
return 'impl value';
}).mockReturnValue('mock return value');
var mockedImplWithoutReturn = jest.genMockFn().mockImpl(function() {
Found 1 matching tests...
 PASS  __tests__/foo-test.js (0.011s)
Running mockedImplWithReturn:
Returned: mock return value
Running mockedImplWithoutReturn:
running impl
Returned: impl value
1 tests passed (1 total)
Run time: 1.075s
// __tests__/foo-test.js
jest.autoMockOff();
describe('hai', function() {
it('asdf2', function() {
require('JSONStream');
});
});
# __tests__/foo-test.coffee
describe 'hai', ->
it 'asdf', ->
foo = require '../foo'
console.log foo
it 'asdf2', ->
foo = require '../foo'
console.log foo
[jeffmo@host ~/test]$ time jest
Found 1 matching tests...
PASS __tests__/foo-test.coffee (0.055s)
42
42
1 tests passed (1 total)
Run time: 1.096s
jest 0.43s user 0.08s system 38% cpu 1.306 total
[jeffmo@host ~/test]$ time jest
[jeffmo@host ~/test]$ time jest
Found 1 matching tests...
PASS __tests__/foo-test.coffee (0.064s)
42
1 tests passed (1 total)
Run time: 1.084s
jest 0.40s user 0.07s system 36% cpu 1.292 total
[jeffmo@host ~/test]$ time jest
Found 1 matching tests...
parsed 83 + 1 files in 0.083330
inferred 83 files in 0.020660
HEIGHT 1: 83
merged (strict) 84 files in 0.023132