Skip to content

Instantly share code, notes, and snippets.

@joebartels
Last active November 24, 2016 13:24
Show Gist options
  • Save joebartels/f984bd6c60b2bcc2229b to your computer and use it in GitHub Desktop.
Save joebartels/f984bd6c60b2bcc2229b to your computer and use it in GitHub Desktop.
{
"presets": ["es2015"],
"plugins": [
"transform-es2015-modules-amd"
]
}
{
"name": "testem-fun",
"version": "0.0.0",
"authors": [
"joseph bartels"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"requirejs": "~2.1.20"
},
"devDependencies": {
"chai": "~3.2.0"
}
}
import { initials } from '../utils/string-tools.js';
export default function Person(name) {
this.name = name;
this.initials = initials(name);
}
import Person from '../person.js';
describe('Person properties', function() {
let fullName = 'Phineas Fletcher';
let person;
beforeEach(function() {
person = new Person(fullName);
});
it('assigns name properly', function() {
chai.assert.equal(person.name, fullName, `person's name is correct.`);
});
it('assigns initials properly', function() {
let expectedInitials = 'PF';
chai.assert.equal(person.initials, expectedInitials, `person's initials are correct.`);
});
});
export function initials(fullName) {
let initials = (fullName || '')
.split(' ')
.map(name => name[0])
.join('');
return initials || 'N/A';
return f && l ? `${f}${l}` : f || l || 'N/A';
};
<!doctye html>
<html>
<head>
<title>Test'em</title>
<link rel="stylesheet" href="/testem/mocha.css">
<script src="/testem/mocha.js"></script>
<script src="/testem.js"></script>
<script src="/bower_components/chai/chai.js"></script>
<script src="/bower_components/requirejs/require.js"></script>
<script>mocha.setup('bdd')</script>
{{#styles}}<link rel="stylesheet" href="{{.}}">{{/styles}}
</head>
<body>
<div id="mocha"></div>
<script>
// require.config({
// baseUrl: 'test'
// });
var files = [];
{{#serve_files}}
files.push("../{{{src}}}");
{{/serve_files}}
require(files, function() {
mocha.run();
});
</script>
</body>
</html>
{
"framework": "mocha",
"src_files": [
"tmp/**/*-test.js"
],
"watch_files": [
"lib/**/*.js"
],
"test_page": "test/index.mustache",
"on_start": "babel lib --out-dir tmp",
"on_exit": "rm -rf tmp/*.js"
}
@chrmod
Copy link

chrmod commented Jan 10, 2016

is live reload running properly in this setup? seems that files are watched properly but babel runs only once on testem start. There is "before_tests" property on testem, it seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment