Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

run_java_unit_tests.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env node
  2. /*
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing,
  12. software distributed under the License is distributed on an
  13. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. KIND, either express or implied. See the License for the
  15. specific language governing permissions and limitations
  16. under the License.
  17. */
  18. var Q = require('q');
  19. var path = require('path');
  20. var superspawn = require('cordova-common').superspawn;
  21. var ProjectBuilder = require('../bin/templates/cordova/lib/builders/ProjectBuilder');
  22. Q.resolve()
  23. .then(_ => console.log('Preparing Gradle wrapper for Java unit tests.'))
  24. .then(_ => new ProjectBuilder(__dirname).runGradleWrapper('gradle'))
  25. .then(_ => gradlew('--version'))
  26. .then(_ => console.log('Gradle wrapper is ready. Running tests now.'))
  27. .then(_ => gradlew('test'))
  28. .then(_ => console.log('Java unit tests completed successfully.'));
  29. process.on('unhandledRejection', err => {
  30. // If err has a stderr property, we have seen the message already
  31. if (!('stderr' in err)) console.error(err.message);
  32. console.error('JAVA UNIT TESTS FAILED!');
  33. process.exitCode = err.code || 1;
  34. });
  35. function gradlew () {
  36. const wrapperPath = path.join(__dirname, 'gradlew');
  37. return superspawn.spawn(wrapperPath, Array.from(arguments), {
  38. stdio: 'inherit',
  39. cwd: __dirname
  40. });
  41. }