This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ReactDOM from 'react-dom'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Clear out the babel-loader cache, and the happypack cache. | |
rm -rf ./node_modules; npm install --silent; | |
rm -rf ./tmp | |
echo '[email protected]' | |
NODE_ENV=production time npm run webpack:compile | |
# Clear out the babel-loader cache, and the happypack cache. | |
rm -rf ./node_modules; npm install; | |
rm -rf ./tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const glob = require('glob'); | |
const acorn = require('acorn-dynamic-import').default; | |
const sourceFiles = glob.sync('../location/*.source.json'); | |
const astFiles = glob.sync('../location/*.ast.json'); | |
const filesToParse = sourceFiles.map(fileLocation => { | |
return JSON.parse(fs.readFileSync(fileLocation, 'utf8')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { expect } from 'chai'; | |
// how a test might have been written Mocha. | |
describe('addition', () => { | |
context('a sane universe', () => { | |
test('one plus two equals three', () => { | |
expect(1 + 2).to.equal(3); | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import chai from 'chai'; | |
import chaiEnzyme from 'chai-enzyme'; | |
chai.use(chaiEnzyme()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import chai from 'chai'; | |
// This is not really a mock, but jest prevents out of scope | |
// variables unless prefixed with "mock". | |
const mockChai = chai; | |
let mockSetup = false; | |
// Here we're "mocking" enzyme, so that we can delay loading of | |
// the utility functions until emzyme is imported in tests. | |
jest.mock('enzyme', () => { | |
const actualEnzyme = require.requireActual('enzyme'); | |
if (!mockSetup) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// There are other differences between Jest and Mocha, | |
// but these were the functions being used at Airbnb. | |
global.context = describe; | |
global.before = beforeAll; | |
global.after = afterEach; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This set of beforeEach/afterEach functions serve to prevent code from | |
* being accidentally run outside of a test's context. | |
* | |
* Basically we catch all intervals and timeouts set during a test, and | |
* then clear them when the test is done running. | |
*/ | |
const setTimeouts = []; | |
const setIntervals = []; | |
const originalSetTimeout = setTimeout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = | |
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BetterCreep extends Creep { | |
constructor(creep) { | |
this._creep = creep; | |
} | |
work() { | |
this._creep.moveTo(); | |
} | |
} |
NewerOlder