☕️ Classic, reliable, trusted test framework for Node.js and the browser
Added `mocha init <path>` to copy client files
TJ Holowaychuk68cf2160655f
diff --git a/.npmignore b/.npmignoreindex f4f8678f..c4f49f0a 100644--- a/.npmignore+++ b/.npmignore@@ -1,4 +1,3 @@-supporttestexamples*.sockdiff --git a/bin/_mocha b/bin/_mochaindex cd55b0dd..f152fef2 100755--- a/bin/_mocha+++ b/bin/_mocha@@ -79,6 +79,21 @@ programprogram.name = 'mocha';+// init command++program+ .command('init <path>')+ .description('initialize a client-side mocha setup at <path>')+ .action(function(path){+ var css = fs.readFileSync('mocha.css');+ var js = fs.readFileSync('mocha.js');+ var tmpl = fs.readFileSync('support/template.html');+ fs.writeFileSync(join(path, 'mocha.css'), css);+ fs.writeFileSync(join(path, 'mocha.js'), js);+ fs.writeFileSync(join(path, 'tests.html'), tmpl);+ process.exit(0);+ });+// --globalsprogram.on('globals', function(val){diff --git a/support/template.html b/support/template.htmlnew file mode 100644index 00000000..0af2fbf6--- /dev/null+++ b/support/template.html@@ -0,0 +1,16 @@+<html>+ <head>+ <title>Mocha</title>+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">+ <link rel="stylesheet" href="mocha.css" />+ </head>+ <body>+ <div id="mocha"></div>+ <script src="mocha.js"></script>+ <script>mocha.setup('bdd')</script>+ <script src="my-tests.js"></script>+ <script>+ mocha.run();+ </script>+ </body>+</html>