Remove test & cover tasks + orphaned dependencies
diff --git a/Gruntfile.js b/Gruntfile.js
index b99ade3..7dec321 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -38,7 +38,5 @@
grunt.loadTasks('tasks');
// defaults
- grunt.registerTask('default', ['compile', 'test']);
- grunt.registerTask('test', ['compile:test', '_test']);
- grunt.registerTask('cover', ['compile', '_cover']);
+ grunt.registerTask('default', ['compile']);
};
diff --git a/package.json b/package.json
index 667a5ef..041ba3b 100644
--- a/package.json
+++ b/package.json
@@ -78,14 +78,10 @@
"eslint-plugin-standard": "^3.0.1",
"grunt": "^1.0.1",
"grunt-contrib-clean": "^1.0.0",
- "istanbul": "^0.4.5",
"jasmine-core": "^3.2.1",
- "jasmine-node": "^1.14.6",
- "jsdom-no-contextify": "^3.1.0",
"karma": "^3.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-jasmine": "^1.1.2",
- "mkdirp": "^0.5.0",
"puppeteer": "^1.8.0"
},
"cordova-platforms": {
diff --git a/tasks/cover.js b/tasks/cover.js
deleted file mode 100644
index 59dc22c..0000000
--- a/tasks/cover.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
-*/
-
-try {
- require('jasmine-node');
- require('istanbul');
-} catch (e) {
- console.error("\none of jasmine-node or istanbul packages is not installed, you need to:\n" +
- "\trun `npm install` from " + require('path').dirname(__dirname)+"\n");
- process.exit(1);
-}
-
-module.exports = function(grunt) {
- grunt.registerTask('_cover', 'measures test coverage using istanbul', function() {
- var done = this.async();
- require('./lib/test-jsdom-coverage')(done);
- });
-};
diff --git a/tasks/lib/collect.js b/tasks/lib/collect.js
deleted file mode 100644
index 0ff45e4..0000000
--- a/tasks/lib/collect.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var fs = require('fs');
-var _path = require('path'); // FIXME _path? seriously?!
-
-module.exports = function collect(path, files, matches) {
- matches = matches || function (path) {
- return path.match(/test\.(\w|-)+\.js$/);
- };
-
- if (fs.statSync(path).isDirectory()) {
- fs.readdirSync(path).forEach(function (item) {
- collect(_path.join(path, item), files, matches);
- });
- }
- else if (matches(path)) {
- files.push(path);
- }
-}
diff --git a/tasks/lib/test-jsdom-coverage.js b/tasks/lib/test-jsdom-coverage.js
deleted file mode 100644
index f2fd047..0000000
--- a/tasks/lib/test-jsdom-coverage.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-/*global __coverage__: true*/
-
-var path = require('path');
-var fs = require('fs');
-var collect = require('./collect');
-var istanbul = require('istanbul');
-var mkdirp = require('mkdirp');
-var jas = require('jasmine-node');
-var testLibName = path.join(__dirname, '..', '..', 'pkg', 'cordova.test.js');
-var testLib = fs.readFileSync(testLibName, 'utf8');
-
-var jsdom = require("jsdom-nogyp").jsdom;
-var document = jsdom(null, null, { url: 'file:///jsdomtest.info/a?b#c' });
-var window = document.createWindow();
-
-module.exports = function(callback) {
-
- console.log('starting node-based tests');
-
- // put jasmine in scope
- Object.keys(jas).forEach(function (key) {
- this[key] = window[key] = global[key] = jas[key];
- });
-
- // Hack to fix jsdom with node v0.11.13+
- delete String.prototype.normalize;
-
- try {
- // instrument loaded cordova.js before it will be loaded into DOM
- var instrumenter = new istanbul.Instrumenter();
- var generatedCode = instrumenter.instrumentSync(testLib);
-
- eval(generatedCode);
- }
- catch (e) {
- console.log("error eval()ing " + testLibName + ": " + e);
- console.log(e.stack);
- throw e;
- }
-
- // hijack require
- require = window.cordova.require;
- define = window.cordova.define;
-
- // load in our tests
- var tests = [];
- collect(path.join(__dirname, '..', '..', 'test'), tests);
- for (var x in tests) {
- eval(fs.readFileSync(tests[x], "utf-8"));
- }
-
- var env = jasmine.getEnv();
- env.addReporter(new jas.TerminalReporter({
- color: true,
- onComplete: function(runner) {
-
- // Check that global __coverage__ variable
- // defined by istanbul is defined and not empty
- if (__coverage__ || Object.keys(__coverage__).length === 0) {
-
- var config = istanbul.config.loadObject(istanbul.config.defaultConfig());
- var reportingDir = config.reporting.dir();
-
- mkdirp.sync(reportingDir);
-
- var file = path.resolve(reportingDir, 'coverage.json'),
- collector = new istanbul.Collector(config),
- reporter = new istanbul.Reporter(config);
-
- console.error('=============================================================================');
- console.error('Writing coverage object [' + file + ']');
-
- // regular expression is necessary to replace filename in report object
- // generated by istanbul (smth. like "14843508345.js") with real filename
- var correctFilenameRe = new RegExp(Object.keys(__coverage__)[0], "g");
- var report = JSON.stringify(__coverage__).replace(correctFilenameRe, testLibName.replace(/\\/g, '\\\\'));
-
- fs.writeFileSync(file, report, 'utf8');
- collector.add(JSON.parse(report));
-
- console.error('Writing coverage reports at [' + path.resolve(reportingDir) + ']');
- console.error('=============================================================================');
-
- reporter.addAll(["lcov", "text"]);
- reporter.write(collector, true, function (win) {
- callback(runner.results().passed());
- });
- } else {
- console.error('No coverage information was collected, exit without writing coverage information');
- callback(runner.results().passed());
- }
- }
- }));
-
- console.log("------------");
- console.log("Unit Tests:");
- env.execute();
-};
\ No newline at end of file
diff --git a/tasks/lib/test-jsdom.js b/tasks/lib/test-jsdom.js
deleted file mode 100644
index 4aa60c3..0000000
--- a/tasks/lib/test-jsdom.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var path = require('path');
-var fs = require('fs');
-var collect = require('./collect');
-var jas = require('jasmine-node');
-var testLibName = path.join(__dirname, '..', '..', 'pkg', 'cordova.test.js');
-var testLib = fs.readFileSync(testLibName, 'utf8');
-
-var jsdom = require("jsdom-no-contextify").jsdom;
-var document = jsdom(undefined, { url: 'file:///jsdomtest.info/a?b#c' });
-var window = document.parentWindow;
-
-module.exports = function(callback) {
-
- console.log('starting node-based tests');
-
- // put jasmine in scope
- Object.keys(jas).forEach(function (key) {
- this[key] = window[key] = global[key] = jas[key];
- });
-
- // Hack to fix jsdom with node v0.11.13+
- delete String.prototype.normalize;
-
- try {
- eval(testLib);
- }
- catch (e) {
- console.log("error eval()ing " + testLibName + ": " + e);
- console.log(e.stack);
- throw e;
- }
-
- // hijack require
- require = window.cordova.require;
- define = window.cordova.define;
- // Set up dummy navigator object
- navigator = window.navigator || {};
-
- // load in our tests
- var tests = [];
- collect(path.join(__dirname, '..', '..', 'test'), tests);
- for (var x in tests) {
- eval(fs.readFileSync(tests[x], "utf-8"));
- }
-
- var env = jasmine.getEnv();
- env.addReporter(new jas.TerminalReporter({
- color: true,
- onComplete: function(runner) { callback(runner.results().passed()); }
- }));
-
- console.log("------------");
- console.log("Unit Tests:");
- env.execute();
-};
diff --git a/tasks/test.js b/tasks/test.js
deleted file mode 100644
index ca2e7ad..0000000
--- a/tasks/test.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
-*/
-try {
- require('jasmine-node');
-} catch (e) {
- console.error("\njasmine-node is not installed, you need to:\n\trun `npm install` from " + require('path').dirname(__dirname)+"\n");
- process.exit(1);
-}
-
-module.exports = function(grunt) {
- grunt.registerTask('_test', 'Runs test in node', function() {
- var done = this.async();
- require('./lib/test-jsdom')(done);
- });
-};