Skip to content

Commit

Permalink
Add es2015 example
Browse files Browse the repository at this point in the history
Refactor to enable `es2015` example
Separate `instrument` and `coverage`
  • Loading branch information
stoffeastrom committed Nov 6, 2017
1 parent f5091ac commit d32de05
Show file tree
Hide file tree
Showing 18 changed files with 1,794 additions and 358 deletions.
16 changes: 16 additions & 0 deletions examples/es2015/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"env": {
"test": {
"sourceMaps": "inline",
"retainLines": true,
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
},
"modules": "amd"
}]
]
}
}
}
13 changes: 13 additions & 0 deletions examples/es2015/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"env": {
"browser": true,
"es6": true
},
"globals": {
"requirejs": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
}
}
1 change: 1 addition & 0 deletions examples/es2015/a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => 'a';
10 changes: 10 additions & 0 deletions examples/es2015/a.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import chai from 'chai';
import getA from './a';

const { expect } = chai;

describe('es2015 - a', () => {
it('should return "a"', () => {
expect(getA()).to.equal('a');
});
});
11 changes: 11 additions & 0 deletions examples/es2015/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype>
<html>
<head>
<title>Test</title>
<meta charset="utf-8">
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/4.0.1/mocha.min.js"></script>
<script data-main="./main.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions examples/es2015/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(() => {
requirejs.config({
paths: {
chai: 'https://cdnjs.cloudflare.com/ajax/libs/chai/4.1.2/chai.min',
},
});
requirejs(window.awFiles, () => {
if (window.awDevtools) {
// We need to wait for Chrome to open the `devtools`
setTimeout(() => mocha.run(), 200);
return;
}
mocha.run();
});
})();
12 changes: 12 additions & 0 deletions examples/requirejs/aw.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
'instrument.exclude': [
'**/coverage/**',
'**/external/**',
'**/autogenerated/**',
'**/*.(html|css|json|txt|ttf|woff|svg)',
'*require*.js',
'*sinon*.js',
'*chai*.js',
'**/*.js',
],
};
2 changes: 0 additions & 2 deletions examples/requirejs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
<head>
<title>Test</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mocha/4.0.1/mocha.min.css" />
</head>
<body>
<div id="mocha"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/4.0.1/mocha.min.js"></script>
<script data-main="./main.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"></script>
</body>
Expand Down
Loading

0 comments on commit d32de05

Please sign in to comment.