installed and configured karma test runner

This commit is contained in:
alecmerdler 2017-01-06 21:27:54 -08:00
parent e658941a43
commit b44665e75d
6 changed files with 144 additions and 10 deletions

View file

@ -16,5 +16,6 @@ run-local.sh
.tox .tox
htmlcov htmlcov
.coverage .coverage
coverage
.cache .cache
test/__pycache__ test/__pycache__

1
.gitignore vendored
View file

@ -17,6 +17,7 @@ GIT_HEAD
.python-version .python-version
.pylintrc .pylintrc
.coverage .coverage
coverage
htmlcov htmlcov
.tox .tox
.cache .cache

69
karma.conf.js Normal file
View file

@ -0,0 +1,69 @@
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
// CDN resources
'node_modules/jquery/dist/jquery.js',
'node_modules/angular/angular.js',
'node_modules/angular-animate/angular-animate.js',
'node_modules/angular-cookies/angular-cookies.js',
'node_modules/angular-md5/angular-md5.js',
'node_modules/angular-mocks/angular-mocks.js',
'node_modules/angular-route/angular-route.js',
'node_modules/angular-sanitize/angular-sanitize.js',
'node_modules/moment/moment.js',
'node_modules/bootstrap-datepicker/dist/js/bootstrap-datepicker.js',
'node_modules/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js',
'node_modules/bootbox/bootbox.js',
'node_modules/underscore/underscore.js',
'node_modules/restangular/dist/restangular.js',
'node_modules/d3/d3.js',
'node_modules/raven-js/dist/raven.js',
'node_modules/cal-heatmap/cal-heatmap.js',
// static/lib resources
'static/lib/**/*.js',
// FIXME: Upgrade angular-file-upload -> ng-file-upload
'https://cdnjs.cloudflare.com/ajax/libs/danialfarid-angular-file-upload/1.4.0/angular-file-upload.js',
'https://cdnjs.cloudflare.com/ajax/libs/danialfarid-angular-file-upload/1.4.0/angular-file-upload-html5-shim.js',
// Application resources
'static/js/tour.js',
'static/js/core-ui.js',
'static/js/core-config-setup.js',
'static/js/app.js',
'static/js/**/*.js',
// Tests
'static/test/**/*.js',
],
exclude: [
'static/js/build/bundle.js',
],
preprocessors: {
'static/lib/ngReact/react.ngReact.min.js': ['webpack'],
'static/lib/angular-moment.min.js': ['webpack'],
},
webpack: {},
webpackMiddleware: {
stats: 'errors-only'
},
reporters: ['dots', 'coverage'],
coverageReporter: {
dir: 'coverage',
type: 'html'
},
client: {
captureConsole: true
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS', 'Chrome'],
singleRun: false,
concurrency: Infinity
});
};

View file

@ -4,6 +4,7 @@
"private": true, "private": true,
"version": "1.0.0", "version": "1.0.0",
"scripts": { "scripts": {
"test": "./node_modules/.bin/karma start --single-run --browsers PhantomJS",
"build": "./node_modules/.bin/webpack --progress -p -v", "build": "./node_modules/.bin/webpack --progress -p -v",
"watch": "./node_modules/.bin/webpack --watch" "watch": "./node_modules/.bin/webpack --watch"
}, },
@ -16,20 +17,39 @@
"@types/angular": "1.5.16", "@types/angular": "1.5.16",
"@types/react": "0.14.39", "@types/react": "0.14.39",
"@types/react-dom": "0.14.17", "@types/react-dom": "0.14.17",
"angular": "1.5.8", "angular": "1.5.3",
"moment": "2.16.0", "angular-animate": "^1.5.3",
"ngreact": "0.3.0", "angular-cookies": "^1.5.3",
"react": "15.3.2", "angular-route": "^1.5.3",
"react-dom": "15.3.2", "angular-sanitize": "^1.5.3",
"typescript": "2.0.3" "bootbox": "^4.1.0",
"bootstrap": "^3.3.2",
"bootstrap-datepicker": "^1.6.4",
"cal-heatmap": "^3.3.10",
"d3": "^3.3.3",
"eonasdan-bootstrap-datetimepicker": "^4.17.43",
"jquery": "1.12.4",
"raven-js": "^3.1.0",
"react": "^15.3.2",
"react-dom": "^15.3.2",
"restangular": "^1.2.0",
"underscore": "^1.5.2"
}, },
"devDependencies": { "devDependencies": {
"css-loader": "0.25.0", "angular-mocks": "^1.5.3",
"jasmine-core": "^2.5.2",
"karma": "^0.13.22",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^0.5.5",
"karma-es6-shim": "^1.0.0",
"karma-intl-shim": "^1.0.3",
"karma-jasmine": "^0.3.8",
"karma-phantomjs-launcher": "^1.0.0",
"karma-webpack": "^1.8.1",
"node-sass": "3.10.1", "node-sass": "3.10.1",
"sass-loader": "4.0.2", "phantomjs-prebuilt": "^2.1.7",
"source-map-loader": "0.1.5",
"style-loader": "0.13.1",
"ts-loader": "0.9.5", "ts-loader": "0.9.5",
"typescript": "2.0.3",
"typings": "1.4.0", "typings": "1.4.0",
"webpack": "1.13.3" "webpack": "1.13.3"
} }

View file

@ -0,0 +1,13 @@
describe("Service: AngularViewArray", function() {
var angularViewArray;
beforeEach(module('quay'));
beforeEach(inject(function($injector) {
angularViewArray = $injector.get('AngularViewArray');
}));
it("sanity test", function() {
expect(angularViewArray.create).toBeDefined();
});
});

View file

@ -0,0 +1,30 @@
// Add properties to window object used by 'app.js' to avoid test errors
window.__config = {
'SERVER_HOSTNAME': "",
'PREFERRED_URL_SCHEME': "",
};
window.__features = {};
window.__oauth = {
'GITHUB_TRIGGER_CONFIG': {
'CLIENT_ID': "",
'GITHUB_ENDPOINT': "",
'AUTHORIZE_ENDPOINT': "",
},
'GITLAB_TRIGGER_CONFIG': {
'CLIENT_ID': "",
'GITLAB_ENDPOINT': "",
'AUTHORIZE_ENDPOINT': "",
}
};
window.__endpoints = {
"/api/v1/user/": {
"get": {
"operationId": "getLoggedInUser",
"parameters": []
},
"x-name": "endpoints.api.user.User",
"x-path": "/api/v1/user/",
"x-tag": "user"
},
};