From af9ba91e5c6c472acef56f08b061d3f7a8cbc78a Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Wed, 21 Jun 2017 14:18:26 +0100 Subject: [PATCH] build(aio): ensure all doc tests are run It is not possible to run all the docs tests directly via the jasmine CLI. Instead we now have a small script that will run jasmine via its library. --- aio/package.json | 2 +- aio/tools/transforms/test.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 aio/tools/transforms/test.js diff --git a/aio/package.json b/aio/package.json index 00fb7462f0..31425140c9 100644 --- a/aio/package.json +++ b/aio/package.json @@ -29,7 +29,7 @@ "docs": "dgeni ./tools/transforms/angular.io-package", "docs-watch": "node tools/transforms/authors-package/watchr.js", "docs-lint": "eslint --ignore-path=\"tools/transforms/.eslintignore\" tools/transforms", - "docs-test": "jasmine tools/transforms/**/*.spec.js", + "docs-test": "node tools/transforms/test.js", "~~update-webdriver": "webdriver-manager update --standalone false --gecko false", "boilerplate:add": "node ./tools/examples/add-example-boilerplate add", "boilerplate:remove": "node ./tools/examples/add-example-boilerplate remove", diff --git a/aio/tools/transforms/test.js b/aio/tools/transforms/test.js new file mode 100644 index 0000000000..48967ddd45 --- /dev/null +++ b/aio/tools/transforms/test.js @@ -0,0 +1,17 @@ +/* + * Use this script to run the tests for the doc generation + * We cannot use the Jasmine CLI directly because it doesn't seem to + * understand the glob and only runs one spec file. + * + * Equally we cannot use a jasmine.json config file because it doesn't + * allow us to set the projectBaseDir, which means that you have to run + * jasmine CLI from this directory. + * + * Using a file like this gives us full control and keeps the package.json + * file clean and simple. + */ + +const Jasmine = require('jasmine'); +const jasmine = new Jasmine({ projectBaseDir: __dirname }); +jasmine.loadConfig({ spec_files: ['**/*.spec.js'] }); +jasmine.execute();