diff --git a/Makefile b/Makefile index d525813f96..07b8ebe3e2 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ MOCK_CFG ?= develop refresh adduser syncdb migrate dbchange dbshell runserver celeryd \ receiver test test_coverage coverage_html ui_analysis_report test_ui test_jenkins dev_build \ release_build release_clean sdist rpmtar mock-rpm mock-srpm rpm-sign \ - deb deb-src debian reprepro setup_tarball sync_ui \ + deb deb-src debian reprepro setup_tarball sync_ui node-tests \ virtualbox-ovf virtualbox-centos-7 virtualbox-centos-6 # Remove setup build files @@ -333,8 +333,10 @@ awx/ui/%: node_modules clean-ui Brocfile.js bower.json $(BROCCOLI_BIN) build $@ -- $(UI_FLAGS) testjs: UI_FLAGS=--node-tests --no-concat --no-styles $(EXTRA_UI_FLAGS) -testjs: awx/ui/build_test - $(MOCHA_BIN) --full-trace $(shell find awx/ui/build_test -name '*-test.js') +testjs: awx/ui/build_test node-tests + +node-tests: + NODE_PATH=awx/ui/build_test $(MOCHA_BIN) --full-trace $(shell find awx/ui/build_test -name '*-test.js') devjs: awx/ui/static diff --git a/awx/ui/client/tests/directives/job-status-graph-test.js b/awx/ui/client/tests/directives/job-status-graph-test.js index ee2fe61660..d1f816a7ee 100644 --- a/awx/ui/client/tests/directives/job-status-graph-test.js +++ b/awx/ui/client/tests/directives/job-status-graph-test.js @@ -3,9 +3,9 @@ import '../support/node'; import {describeModule} from '../support/describe-module'; -import '../../src/shared/Utilities'; -import '../../src/shared/RestServices'; -import JobStatusGraph from '../../src/dashboard/graphs/job-status/main'; +import 'shared/Utilities'; +import 'shared/RestServices'; +import JobStatusGraph from 'dashboard/graphs/job-status/main'; var resizeHandler = sinon.spy(); diff --git a/awx/ui/client/tests/features/features.controller-test.js b/awx/ui/client/tests/features/features.controller-test.js index 5584af317d..3418b29653 100644 --- a/awx/ui/client/tests/features/features.controller-test.js +++ b/awx/ui/client/tests/features/features.controller-test.js @@ -1,6 +1,6 @@ import '../support/node'; -import featuresController from '../../src/shared/features/features.controller'; +import featuresController from 'shared/features/features.controller'; describe('featuresController', function() { diff --git a/awx/ui/client/tests/features/features.service-test.js b/awx/ui/client/tests/features/features.service-test.js index fc2261ad82..87ad60650a 100644 --- a/awx/ui/client/tests/features/features.service-test.js +++ b/awx/ui/client/tests/features/features.service-test.js @@ -1,6 +1,6 @@ import '../support/node'; -import features from '../../src/shared/features/main'; +import features from 'shared/features/main'; import {describeModule} from '../support/describe-module'; //test that it returns features, as well as test that it is returned in rootScope diff --git a/awx/ui/client/tests/job-templates/delete-job-template.service-test.js b/awx/ui/client/tests/job-templates/delete-job-template.service-test.js index a2614f697a..f301995c57 100644 --- a/awx/ui/client/tests/job-templates/delete-job-template.service-test.js +++ b/awx/ui/client/tests/job-templates/delete-job-template.service-test.js @@ -1,6 +1,6 @@ import '../support/node'; -import jobTemplates from '../../src/job-templates/main'; +import jobTemplates from 'job-templates/main'; import {describeModule} from '../support/describe-module'; describeModule(jobTemplates.name) diff --git a/awx/ui/client/tests/multi-select-list/multi-select-list.directive-test.js b/awx/ui/client/tests/multi-select-list/multi-select-list.directive-test.js index 8cbd840421..ad0cf8c7c9 100644 --- a/awx/ui/client/tests/multi-select-list/multi-select-list.directive-test.js +++ b/awx/ui/client/tests/multi-select-list/multi-select-list.directive-test.js @@ -1,7 +1,7 @@ import '../support/node'; import {describeModule} from '../support/describe-module'; -import mod from '../../src/shared/multi-select-list/main'; +import mod from 'shared/multi-select-list/main'; describeModule(mod.name) .testDirective('multiSelectList', function(test) { diff --git a/awx/ui/client/tests/multi-select-list/select-all.directive-test.js b/awx/ui/client/tests/multi-select-list/select-all.directive-test.js index ec4f23d079..5a3fdea4b8 100644 --- a/awx/ui/client/tests/multi-select-list/select-all.directive-test.js +++ b/awx/ui/client/tests/multi-select-list/select-all.directive-test.js @@ -1,7 +1,7 @@ import '../support/node'; import {describeModule} from '../support/describe-module'; -import mod from '../../src/shared/multi-select-list/main'; +import mod from 'shared/multi-select-list/main'; var mockController = { selectAll: sinon.spy(), diff --git a/awx/ui/client/tests/services/job-status-graph-data-test.js b/awx/ui/client/tests/services/job-status-graph-data-test.js index d079ebe889..ee1828f2ba 100644 --- a/awx/ui/client/tests/services/job-status-graph-data-test.js +++ b/awx/ui/client/tests/services/job-status-graph-data-test.js @@ -1,7 +1,7 @@ import '../support/node'; import {describeModule} from '../support/describe-module'; -import JobStatusGraph from '../../src/dashboard/graphs/job-status/main'; +import JobStatusGraph from 'dashboard/graphs/job-status/main'; var processErrors = sinon.spy(); diff --git a/awx/ui/client/tests/shared/lodash-as-promised-test.js b/awx/ui/client/tests/shared/lodash-as-promised-test.js index 9e0ee8f2a6..66d7ca164f 100644 --- a/awx/ui/client/tests/shared/lodash-as-promised-test.js +++ b/awx/ui/client/tests/shared/lodash-as-promised-test.js @@ -1,6 +1,6 @@ import '../support/node'; -import '../../src/shared/main'; +import 'shared/main'; describe('LodashAsPromised', function() { diff --git a/awx/ui/client/tests/system-tracking/compare-facts/flat-test.js b/awx/ui/client/tests/system-tracking/compare-facts/flat-test.js index 44490869fb..ff97ca2d11 100644 --- a/awx/ui/client/tests/system-tracking/compare-facts/flat-test.js +++ b/awx/ui/client/tests/system-tracking/compare-facts/flat-test.js @@ -2,7 +2,7 @@ import '../../support/node'; -import compareFacts from '../../../src/system-tracking/compare-facts/flat'; +import compareFacts from 'system-tracking/compare-facts/flat'; // This makes this test runnable in node OR karma. The sheer // number of times I had to run this test made the karma diff --git a/awx/ui/client/tests/system-tracking/compare-facts/nested-test.js b/awx/ui/client/tests/system-tracking/compare-facts/nested-test.js index 936648663d..914cf6ae6c 100644 --- a/awx/ui/client/tests/system-tracking/compare-facts/nested-test.js +++ b/awx/ui/client/tests/system-tracking/compare-facts/nested-test.js @@ -2,7 +2,7 @@ import '../../support/node'; -import compareFacts from '../../../src/system-tracking/compare-facts/nested'; +import compareFacts from 'system-tracking/compare-facts/nested'; describe('CompareFacts.Nested', function() { diff --git a/awx/ui/client/tests/system-tracking/single-host-data.service-test.js b/awx/ui/client/tests/system-tracking/single-host-data.service-test.js index e14901e66b..fb65cf6bec 100644 --- a/awx/ui/client/tests/system-tracking/single-host-data.service-test.js +++ b/awx/ui/client/tests/system-tracking/single-host-data.service-test.js @@ -1,8 +1,8 @@ import '../support/node'; -import systemTracking from '../../src/system-tracking/data-services/main'; +import systemTracking from 'system-tracking/data-services/main'; import {describeModule} from '../support/describe-module'; -import moment from '../../src/shared/moment/moment'; +import moment from 'shared/moment/moment'; describeModule(systemTracking.name) .testService('factScanDataService', function(test, restStub) { diff --git a/testem.yml b/testem.yml index b8325fb636..fe6c8a0fae 100644 --- a/testem.yml +++ b/testem.yml @@ -1,25 +1,23 @@ --- framework: mocha -cwd: awx/ui/ +cwd: awx/ui/client port: 7358 src_files: - - client/**/*.js - - client/**/*.js + - src/**/*.js - tests/**/*.js serve_files: - - static/tower.concat.js - - static/tests/**/*.js - - static/tests/unit.js + - ../static/tower.concat.js + - ../static/tests/**/*.js + - ../static/tests/unit.js unsafe_file_serving: true test_page: tests.html disable_watching: true routes: - /awx/ui/static: /static - /tests.html: ../../packaging/grunt/testem.mustache - /test-loader.js: client/lib/ember-cli-test-loader/test-loader.js - /vendor: ../../node_modules - /angular-mocks.js: static/lib/angular-mocks/angular-mocks.js - /templates.js: static/templates.js + /static: ../static + /tests.html: ../../../packaging/grunt/testem.mustache + /test-loader.js: lib/ember-cli-test-loader/test-loader.js + /vendor: ../../../node_modules + /angular-mocks.js: lib/angular-mocks/angular-mocks.js reporter: xunit launch_in_dev: - Mocha @@ -27,4 +25,4 @@ launch_in_ci: - PhantomJS launchers: Mocha: - command: npm test + command: make node-tests