Skip to content

Commit

Permalink
move everything into docs/ in prep for moving repo into mocha proper
Browse files Browse the repository at this point in the history
- some jekyll tweaks were needed; we can no longer consume the
  `github-pages` gem apparently since they added support for themes
- added `markdown-toc` dev dep to build the toc
- added `buildDocs` and `serveDocs` scripts
- miraculously avoided monkeying with the content itself

Signed-off-by: Christopher Hiller <[email protected]>
  • Loading branch information
boneskull committed Dec 6, 2017
1 parent 5752458 commit c247032
Show file tree
Hide file tree
Showing 54 changed files with 117 additions and 6,065 deletions.
4 changes: 0 additions & 4 deletions .editorconfig

This file was deleted.

4 changes: 0 additions & 4 deletions .gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions Gemfile

This file was deleted.

22 changes: 0 additions & 22 deletions LICENSE-MIT 

This file was deleted.

36 changes: 0 additions & 36 deletions README.md

This file was deleted.

12 changes: 0 additions & 12 deletions _config.yml

This file was deleted.

3 changes: 3 additions & 0 deletions docs/.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
env:
browser: true
node: false
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# mochajs.org

*So you wanna build the site?*

[mochajs.org](https://mochajs.org) is built using [Jekyll](http://jekyllrb.com), the popular static site generator.

## Prerequisites

- Ruby
- RubyGems
- Bundler (`gem install bundler`)
- Node.js v4.0.0 or greater

## Development

1. Run `npm install` to get Node.js deps.
2. Run `bundle install` to install Jekyll and its dependencies. This may or may not require elevated privileges, depending on your system.
3. To serve the site and rebuild as changes are made, execute `npm run serveDocs`.
4. To rebuild the site *once*, execute `npm start buildDocs`.

### Notes

- The content lives in `docs/index.md`; everything else is markup, scripts, assets, etc.
- `docs/index.md` may be mutated upon build. If you update the table of contents, **you must commit `index.md`**; GitHub won't do it for you.
- `docs/_site/` is where the generated static site lives (and is what you see at [mochajs.org](https://mochajs.org)). It is *not* under version control.

## License

:copyright: 2016-2017 [JS Foundation](https://js.foundation) and contributors.

Content licensed [CC-BY-4.0](https://raw.githubusercontent.com/mochajs/mocha/master/docs/LICENSE-CC-BY-4.0).

Code licensed [MIT](https://raw.githubusercontent.com/mochajs/mocha/master/LICENSE-MIT).
8 changes: 8 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
url: https://mochajs.org
exclude:
- README.md
- .*
- LICENSE*
repository: mochajs/mocha
source: docs

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions docs/example/async-dump.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

const {createHook} = require('async_hooks');
const {stackTraceFilter} = require('mocha/lib/utils');
const allResources = new Map();
const resourceActivity = new Set();

const filterStack = stackTraceFilter();

const hook = createHook({
init(asyncId, type, triggerAsyncId) {
allResources.set(asyncId, {type, triggerAsyncId, stack: (new Error()).stack});
},
before(asyncId) {
resourceActivity.add(asyncId);
},
after(asyncId) {
resourceActivity.delete(asyncId);
},
destroy(asyncId) {
allResources.delete(asyncId);
}
}).enable();

global.asyncDump = module.exports = () => {
hook.disable();
console.error('STUFF STILL IN THE EVENT LOOP:')
allResources.forEach(value=> {
console.error(`Type: ${value.type}`);
console.error(filterStack(value.stack));
console.error('\n');
});
};
File renamed without changes.
22 changes: 22 additions & 0 deletions docs/example/debug-hanging-mocha.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

const net = require('net');
const assert = require('assert');

describe('how to debug Mocha when it hangs', function () {
before(function (done) {
const server = net.createServer();
server.listen(10101, done);
});

after(function () {
global.asyncDump();
});

it('should complete, but Mocha should not exit', function(done) {
const sock = net.createConnection(10101, () => {
assert.deepEqual(sock.address().family, 'IPv4');
done();
});
});
});
6 changes: 3 additions & 3 deletions example/tests.html → docs/example/tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<head>
<meta charset="utf-8">
<title>Mocha</title>
<link rel="stylesheet" href="mocha.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/mocha/4.0.1/mocha.min.css">
<link rel="shortcut icon" href="../favicon.ico">
</head>
<body>
<div id="mocha"></div>
<script src="mocha.js"></script>
<script src="chai.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/4.0.1/mocha.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chai/4.1.2/chai.min.js"></script>
<script>mocha.setup('bdd')</script>
<script>expect = chai.expect</script>
<script src="Array.js"></script>
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
15 changes: 15 additions & 0 deletions docs/js/avatars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(function () {
'use strict';
// dumb thing that helps with animation of avatars
var avatars = window.avatars = function (type) {
return function avatarLoaded () {
avatars[type] = typeof avatars[type] === 'number' ? avatars[type] + 1 : 1;
if (avatars[type] === 30) {
document.getElementById(type).classList.add('onload');
}
};
};

avatars.backerLoaded = avatars('_backers');
avatars.sponsorLoaded = avatars('_sponsors');
}());
File renamed without changes.
Loading

0 comments on commit c247032

Please sign in to comment.