npm: Fixed `test` script (#1809) This solves the problem that is wasn't possible to pass arguments to `tests/run.js`.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/package.json b/package.json
index dce27e1..c667d63 100755
--- a/package.json
+++ b/package.json
@@ -5,7 +5,10 @@
"main": "prism.js",
"style": "themes/prism.css",
"scripts": {
- "test": "mocha tests/testrunner-tests.js && mocha tests/run.js && mocha tests/plugins/**/*.js"
+ "test:runner": "mocha tests/testrunner-tests.js",
+ "test:languages": "mocha tests/run.js",
+ "test:plugins": "mocha tests/plugins/**/*.js",
+ "test": "npm run test:runner && npm run test:languages && npm run test:plugins"
},
"repository": {
"type": "git",
diff --git a/test-suite.html b/test-suite.html
index 97dd15e..11bf139 100644
--- a/test-suite.html
+++ b/test-suite.html
@@ -30,8 +30,8 @@
<section id="running-tests-for-specific-languages">
<h2>Running tests for specific languages</h2>
- <p>To run the tests only for one language, you can use the <code>language</code> parameter: <code class="language-bash">npm test -- --language=markup</code>.</p>
- <p>You can even specify multiple languages: <code class="language-bash">npm test -- --language=markup --language=css</code>.</p>
+ <p>To run the tests only for one language, you can use the <code>language</code> parameter: <code class="language-bash">npm run test:languages -- --language=markup</code>.</p>
+ <p>You can even specify multiple languages: <code class="language-bash">npm run test:languages -- --language=markup --language=css</code>.</p>
</section>
</section>
@@ -121,7 +121,7 @@ This is a comment explaining this test case.</code></pre>
<li>All empty structures are removed.</li>
</ul>
<p>To get a pretty-printed version of the simplified token stream of a failed test, add the <code>--pretty</code> modifier. Keep in mind that the pretty-printed token stream is indented using spaces, you may need to convert these to tabs. (Most editors today have an option which handles the conversion for you.)<br>
- E.g. <code class="language-bash">npm test -- --pretty</code>.</p>
+ E.g. <code class="language-bash">npm run test:languages -- --pretty</code>.</p>
<p>For further information: reading the tests of the test runner (<code>tests/testrunner-tests.js</code>) will help you understand the transformation.</p>
</section>
</section>