Skip to content

Instantly share code, notes, and snippets.

@vitalets
vitalets / run.js
Last active Dec 5, 2017
Mocha ES6 modules: correct run.js
View run.js
import './sum.test.js';
mocha.checkLeaks();
mocha.run();
View setup.js
import 'https://unpkg.com/chai@4.1.2/chai.js';
mocha.setup('bdd');
View run.js
import 'https://unpkg.com/expect.js@0.3.1/index.js';
import 'https://unpkg.com/mocha@4.0.1/mocha.js';
mocha.setup('bdd');
import './sum.test.js';
mocha.checkLeaks();
mocha.run();
View sum.test.js
import sum from './sum.js';
describe('sum', function () {
it('should return sum of arguments', function () {
chai.expect(sum(1, 2)).to.equal(3);
});
});
View sum.js
export default function sum(a, b) {
return a + b;
}
@vitalets
vitalets / sum.js
Last active Dec 8, 2017
ES5 sum js
View sum.js
function sum(a, b) {
return a + b;
}
@vitalets
vitalets / index.html
Last active Dec 8, 2017
Mocha ES6 modules: html after cleanup
View index.html
<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
<link href="https://unpkg.com/mocha@4.0.1/mocha.css" rel="stylesheet" />
</head>
<body>
<div id="mocha"></div>
<script src="https://unpkg.com/chai@4.1.2/chai.js"></script>
@vitalets
vitalets / index.html
Last active Dec 8, 2017
Mocha ES6 modules
View index.html
<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>
<link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet" />
</head>
<body>
<div id="mocha"></div>
<script src="https://cdn.rawgit.com/jquery/jquery/2.1.4/dist/jquery.min.js"></script>
View react-runtyper-group-by-tests.txt
PASS src/isomorphic/classic/__tests__/ReactContextValidator-test.js
src/renderers/shared/shared/shouldUpdateReactComponent.js:26
Strict equal of different types: {"key":null,"ref":nu... (object) === false (boolean)
Strict equal of different types: [object Object] (object) === false (boolean)
src/renderers/shared/shared/shouldUpdateReactComponent.js:27
Strict equal of different types: {"key":null,"ref":nu... (object) === false (boolean)
Strict equal of different types: [object Object] (object) === false (boolean)
src/renderers/shared/stack/reconciler/ReactCompositeComponent.js:1258
View react-runtyper-result.txt
src/isomorphic/classic/types/ReactPropTypes.js:132
Strict equal of different types: true (boolean) === "red" (string)
Strict equal of different types: true (boolean) === "blue" (string)
Strict equal of different types: [] (Array) === "red" (string)
Strict equal of different types: [] (Array) === "blue" (string)
Strict equal of different types: false (boolean) === 0 (number)
Strict equal of different types: false (boolean) === "false" (string)
Strict equal of different types: NaN === "red" (string)
Strict equal of different types: NaN === "blue" (string)
You can’t perform that action at this time.