Commit 7c47cc94 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett Committed by Mike Greiling

Swapped out teaspoon for karma

parent 3eb85697
......@@ -291,7 +291,7 @@ rake db:seed_fu:
paths:
- log/development.log
teaspoon:
karma:
cache:
paths:
- vendor/ruby
......@@ -300,9 +300,9 @@ teaspoon:
<<: *use-db
<<: *dedicated-runner
script:
- npm install
- npm link istanbul
- rake teaspoon
- rake webpack:compile
- npm run karma-start
artifacts:
name: coverage-javascript
expire_in: 31d
......@@ -381,8 +381,6 @@ lint:javascript:
- node_modules/
stage: test
image: "node:7.1"
before_script:
- npm install
script:
- npm --silent run eslint
......@@ -393,8 +391,6 @@ lint:javascript:report:
- node_modules/
stage: post-test
image: "node:7.1"
before_script:
- npm install
script:
- find app/ spec/ -name '*.js' -or -name '*.js.es6' -exec sed --in-place 's|/\* eslint-disable .*\*/||' {} \; # run report over all files
- npm --silent run eslint-report || true # ignore exit code
......@@ -444,7 +440,7 @@ pages:
<<: *dedicated-runner
dependencies:
- coverage
- teaspoon
- karma
- lint:javascript:report
script:
- mv public/ .public/
......
var path = require('path');
var webpackConfig = require('./webpack.config.js');
var ROOT_PATH = path.resolve(__dirname, '..');
// Karma configuration
module.exports = function(config) {
config.set({
basePath: ROOT_PATH,
frameworks: ['jquery-2.1.0', 'jasmine'],
files: [
'spec/javascripts/*_spec.js',
'spec/javascripts/*_spec.js.es6',
{ pattern: 'spec/javascripts/fixtures/**/*.html', included: false, served: true },
{ pattern: 'spec/javascripts/fixtures/**/*.json', included: false, served: true },
],
preprocessors: {
'spec/javascripts/*_spec.js': ['webpack'],
'spec/javascripts/*_spec.js.es6': ['webpack'],
'app/assets/javascripts/**/*.js': ['webpack'],
'app/assets/javascripts/**/*.js.es6': ['webpack'],
},
webpack: webpackConfig,
webpackMiddleware: { stats: 'errors-only' },
});
};
......@@ -58,7 +58,7 @@ var config = {
{
test: /\.(js|es6)$/,
loader: 'imports-loader',
query: 'this=>window'
query: '$=jquery,jQuery=jquery,this=>window'
},
{
test: /\.json$/,
......@@ -87,7 +87,10 @@ var config = {
'vendor': path.join(ROOT_PATH, 'vendor/assets/javascripts'),
'vue$': 'vue/dist/vue.js',
'vue-resource$': 'vue-resource/dist/vue-resource.js'
}
},
root: [
path.join(ROOT_PATH, 'app/assets/javascripts'),
],
}
}
......
......@@ -6,7 +6,7 @@ namespace :gitlab do
%W(rake rubocop),
%W(rake spinach),
%W(rake spec),
%W(rake teaspoon)
%W(npm run karma-start)
]
cmds.each do |cmd|
......
......@@ -7,5 +7,5 @@ end
unless Rails.env.production?
desc "GitLab | Run all tests on CI with simplecov"
task test_ci: [:rubocop, :brakeman, :teaspoon, :spinach, :spec]
task test_ci: [:rubocop, :brakeman, :'karma-start', :spinach, :spec]
end
......@@ -4,7 +4,8 @@
"dev-server": "node_modules/.bin/webpack-dev-server --config config/webpack.config.js",
"eslint": "eslint --max-warnings 0 --ext .js,.js.es6 .",
"eslint-fix": "npm run eslint -- --fix",
"eslint-report": "npm run eslint -- --format html --output-file ./eslint-report.html"
"eslint-report": "npm run eslint -- --format html --output-file ./eslint-report.html",
"karma-start": "karma start config/karma.config.js"
},
"dependencies": {
"babel": "^5.8.38",
......@@ -35,6 +36,11 @@
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jasmine": "^2.1.0",
"istanbul": "^0.4.5",
"karma": "^1.3.0"
"jasmine-core": "^2.5.2",
"jasmine-jquery": "^2.1.1",
"karma": "^1.3.0",
"karma-jasmine": "^1.1.0",
"karma-jquery": "^0.1.0",
"karma-webpack": "^1.8.0"
}
}
/*= require lib/utils/text_utility */
/*= require abuse_reports */
require('./spec_helper');
require('lib/utils/text_utility');
require('abuse_reports');
((global) => {
describe('Abuse Reports', () => {
......
/* eslint-disable no-unused-expressions, comma-spacing, prefer-const, no-prototype-builtins, semi, no-new, keyword-spacing, no-plusplus, no-shadow, max-len */
/*= require js.cookie.js */
/*= require jquery.endless-scroll.js */
/*= require pager */
/*= require activities */
require('./spec_helper');
require('vendor/js.cookie.js');
require('vendor/jquery.endless-scroll.js');
require('pager');
require('activities');
(() => {
window.gon || (window.gon = {});
......
/* eslint-disable space-before-function-paren, no-var, one-var, one-var-declaration-per-line, no-unused-expressions, comma-dangle, new-parens, no-unused-vars, quotes, jasmine/no-spec-dupes, prefer-template, padded-blocks, max-len */
/* global AwardsHandler */
/*= require awards_handler */
/*= require jquery */
/*= require js.cookie */
/*= require ./fixtures/emoji_menu */
require('./spec_helper');
require('awards_handler');
require('vendor/js.cookie');
require('./fixtures/emoji_menu');
(function() {
var awardsHandler, lazyAssert, urlRoot;
......
/* eslint-disable space-before-function-paren, no-var, comma-dangle, no-return-assign, padded-blocks, max-len */
/*= require behaviors/autosize */
require('behaviors/autosize');
(function() {
describe('Autosize behavior', function() {
......
/* eslint-disable space-before-function-paren, no-var, no-return-assign, comma-dangle, jasmine/no-spec-dupes, new-cap, padded-blocks, max-len */
/*= require behaviors/quick_submit */
require('./spec_helper');
require('behaviors/quick_submit');
(function() {
describe('Quick Submit behavior', function() {
......
/* eslint-disable space-before-function-paren, no-var, padded-blocks */
/*= require behaviors/requires_input */
require('./spec_helper');
require('behaviors/requires_input');
(function() {
describe('requiresInput', function() {
......
......@@ -6,19 +6,18 @@
/* global listObj */
/* global listObjDuplicate */
//= require jquery
//= require jquery_ujs
//= require js.cookie
//= require vue
//= require vue-resource
//= require lib/utils/url_utility
//= require boards/models/issue
//= require boards/models/label
//= require boards/models/list
//= require boards/models/user
//= require boards/services/board_service
//= require boards/stores/boards_store
//= require ./mock_data
require('jquery_ujs');
require('js.cookie');
require('vue');
require('vue-resource');
require('lib/utils/url_utility');
require('boards/models/issue');
require('boards/models/label');
require('boards/models/list');
require('boards/models/user');
require('boards/services/board_service');
require('boards/stores/boards_store');
require('./mock_data');
describe('Store', () => {
beforeEach(() => {
......
......@@ -2,19 +2,18 @@
/* global BoardService */
/* global ListIssue */
//= require jquery
//= require jquery_ujs
//= require js.cookie
//= require vue
//= require vue-resource
//= require lib/utils/url_utility
//= require boards/models/issue
//= require boards/models/label
//= require boards/models/list
//= require boards/models/user
//= require boards/services/board_service
//= require boards/stores/boards_store
//= require ./mock_data
require('jquery_ujs');
require('js.cookie');
require('vue');
require('vue-resource');
require('lib/utils/url_utility');
require('boards/models/issue');
require('boards/models/label');
require('boards/models/list');
require('boards/models/user');
require('boards/services/board_service');
require('boards/stores/boards_store');
require('./mock_data');
describe('Issue model', () => {
let issue;
......
......@@ -5,19 +5,18 @@
/* global List */
/* global listObj */
//= require jquery
//= require jquery_ujs
//= require js.cookie
//= require vue
//= require vue-resource
//= require lib/utils/url_utility
//= require boards/models/issue
//= require boards/models/label
//= require boards/models/list
//= require boards/models/user
//= require boards/services/board_service
//= require boards/stores/boards_store
//= require ./mock_data
require('jquery_ujs');
require('js.cookie');
require('vue');
require('vue-resource');
require('lib/utils/url_utility');
require('boards/models/issue');
require('boards/models/label');
require('boards/models/list');
require('boards/models/user');
require('boards/services/board_service');
require('boards/stores/boards_store');
require('./mock_data');
describe('List model', () => {
let list;
......
//= require lib/utils/bootstrap_linked_tabs
require('./spec_helper');
require('lib/utils/bootstrap_linked_tabs');
(() => {
describe('Linked Tabs', () => {
......
......@@ -2,11 +2,12 @@
/* global Build */
/* global Turbolinks */
//= require lib/utils/datetime_utility
//= require build
//= require breakpoints
//= require jquery.nicescroll
//= require turbolinks
require('./spec_helper');
require('lib/utils/datetime_utility');
require('build');
require('breakpoints');
require('vendor/jquery.nicescroll');
require('vendor/turbolinks');
describe('Build', () => {
const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/builds/1`;
......
/* eslint-disable no-new, padded-blocks */
/*= require sidebar */
/*= require jquery */
/*= require js.cookie */
/*= require lib/utils/text_utility */
require('./spec_helper');
require('sidebar');
require('vendor/js.cookie');
require('lib/utils/text_utility');
((global) => {
describe('Dashboard', () => {
......
//= require lib/utils/datetime_utility
require('lib/utils/datetime_utility');
(() => {
describe('Date time utils', () => {
......
/* eslint-disable no-extra-semi, jasmine/no-global-setup, dot-notation, jasmine/no-expect-in-setup-teardown, max-len */
/* global CommentsStore */
//= require vue
//= require diff_notes/models/discussion
//= require diff_notes/models/note
//= require diff_notes/stores/comments
require('diff_notes/models/discussion');
require('diff_notes/models/note');
require('diff_notes/stores/comments');
(() => {
function createDiscussion(noteId = 1, resolved = true) {
......
//= require vue
//= require environments/components/environment_actions
require('./spec_helper');
require('vue');
require('environments/components/environment_actions');
describe('Actions Component', () => {
preloadFixtures('static/environments/element.html.raw');
......
//= require vue
//= require environments/components/environment_external_url
require('./spec_helper');
require('vue');
require('environments/components/environment_external_url');
describe('External URL Component', () => {
preloadFixtures('static/environments/element.html.raw');
......
//= require vue
//= require timeago
//= require environments/components/environment_item
require('./spec_helper');
require('vue');
require('timeago');
require('environments/components/environment_item');
describe('Environment item', () => {
preloadFixtures('static/environments/table.html.raw');
......
//= require vue
//= require environments/components/environment_rollback
require('./spec_helper');
require('vue');
require('environments/components/environment_rollback');
describe('Rollback Component', () => {
preloadFixtures('static/environments/element.html.raw');
......
//= require vue
//= require environments/components/environment_stop
require('./spec_helper');
require('vue');
require('environments/components/environment_stop');
describe('Stop Component', () => {
preloadFixtures('static/environments/element.html.raw');
......
/* global environmentsList */
//= require vue
//= require environments/stores/environments_store
//= require ./mock_data
require('vue');
require('environments/stores/environments_store');
require('./mock_data');
(() => {
describe('Store', () => {
......
/* eslint-disable no-unused-vars */
const environmentsList = [
{
id: 31,
......
/* eslint-disable space-before-function-paren, no-var, padded-blocks */
/*= require extensions/array */
require('extensions/array');
(function() {
describe('Array extensions', function() {
......
/*= require extensions/element */
require('extensions/element');
(() => {
describe('Element extensions', function () {
......
/* eslint-disable space-before-function-paren, no-var, padded-blocks */
/*= require extensions/jquery */
require('extensions/jquery');
(function() {
describe('jQuery extensions', function() {
......
/*= require extensions/object */
require('extensions/object');
describe('Object extensions', () => {
describe('assign', () => {
......
/* eslint-disable comma-dangle, prefer-const, no-param-reassign, no-plusplus, semi, no-unused-expressions, arrow-spacing, max-len */
/* global Turbolinks */
/*= require jquery */
/*= require gl_dropdown */
/*= require turbolinks */
/*= require lib/utils/common_utils */
/*= require lib/utils/type_utility */
require('./spec_helper');
require('gl_dropdown');
require('vendor/turbolinks');
require('lib/utils/common_utils');
require('lib/utils/type_utility');
(() => {
const NON_SELECTABLE_CLASSES = '.divider, .separator, .dropdown-header, .dropdown-menu-empty-link';
......
/* eslint-disable space-before-function-paren, arrow-body-style, indent, padded-blocks */
//= require jquery
//= require gl_field_errors
require('./spec_helper');
require('gl_field_errors');
((global) => {
preloadFixtures('static/gl_field_errors.html.raw');
......
......@@ -3,7 +3,7 @@
/* global ContributorsGraph */
/* global ContributorsMasterGraph */
//= require graphs/stat_graph_contributors_graph
require('graphs/stat_graph_contributors_graph');
describe("ContributorsGraph", function () {
describe("#set_x_domain", function () {
......
/* eslint-disable quotes, padded-blocks, no-var, camelcase, object-curly-spacing, semi, indent, object-property-newline, comma-dangle, comma-spacing, spaced-comment, max-len, key-spacing, vars-on-top, quote-props, no-multi-spaces */
/* global ContributorsStatGraphUtil */
//= require graphs/stat_graph_contributors_util
require('graphs/stat_graph_contributors_util');
describe("ContributorsStatGraphUtil", function () {
......
/* eslint-disable quotes, padded-blocks, semi */
/* global StatGraph */
//= require graphs/stat_graph
require('graphs/stat_graph');
describe("StatGraph", function () {
......
/* eslint-disable space-before-function-paren, padded-blocks, no-var */
/*= require header */
/*= require lib/utils/text_utility */
/*= require jquery */
require('./spec_helper');
require('header');
require('lib/utils/text_utility');
(function() {
......
/* global Issuable */
/* global Turbolinks */
//= require issuable
//= require turbolinks
require('issuable');
require('turbolinks');
(() => {
const BASE_URL = '/user/project/issues?scope=all&state=closed';
......
/* eslint-disable space-before-function-paren, no-var, one-var, one-var-declaration-per-line, no-use-before-define, indent, no-trailing-spaces, comma-dangle, padded-blocks, max-len */
/* global Issue */
/*= require lib/utils/text_utility */
/*= require issue */
require('./spec_helper');
require('lib/utils/text_utility');
require('issue');
(function() {
var INVALID_URL = 'http://goesnowhere.nothing/whereami';
......
......@@ -2,17 +2,16 @@
/* global IssuableContext */
/* global LabelsSelect */
//= require lib/utils/type_utility
//= require jquery
//= require bootstrap
//= require gl_dropdown
//= require select2
//= require jquery.nicescroll
//= require api
//= require create_label
//= require issuable_context
//= require users_select
//= require labels_select
require('./spec_helper');
require('lib/utils/type_utility');
require('gl_dropdown');
require('select2');
require('vendor/jquery.nicescroll');
require('api');
require('create_label');
require('issuable_context');
require('users_select');
require('labels_select');
(() => {
let saveLabelCount = 0;
......
//= require lib/utils/common_utils
require('lib/utils/common_utils');
(() => {
describe('common_utils', () => {
......
/* eslint-disable space-before-function-paren, no-var, no-param-reassign, quotes, prefer-template, no-else-return, new-cap, dot-notation, no-return-assign, comma-dangle, no-new, one-var, one-var-declaration-per-line, no-plusplus, jasmine/no-spec-dupes, no-underscore-dangle, padded-blocks, max-len */
/* global LineHighlighter */
/*= require line_highlighter */
require('./spec_helper');
require('line_highlighter');
(function() {
describe('LineHighlighter', function() {
......
/* eslint-disable space-before-function-paren, no-return-assign, padded-blocks */
/* global MergeRequest */
/*= require merge_request */
require('./spec_helper');
require('merge_request');
(function() {
describe('MergeRequest', function() {
......
/* eslint-disable no-var, comma-dangle, object-shorthand */
/*= require merge_request_tabs */
//= require breakpoints
//= require lib/utils/common_utils
//= require jquery.scrollTo
require('./spec_helper');
require('merge_request_tabs');
require('breakpoints');
require('lib/utils/common_utils');
require('vendor/jquery.scrollTo');
(function () {
describe('MergeRequestTabs', function () {
......
/* eslint-disable space-before-function-paren, quotes, comma-dangle, dot-notation, indent, quote-props, no-var, padded-blocks, max-len */
/*= require merge_request_widget */
/*= require lib/utils/datetime_utility */
require('merge_request_widget');
require('lib/utils/datetime_utility');
(function() {
describe('MergeRequestWidget', function() {
......
/* eslint-disable no-new */
//= require flash
//= require mini_pipeline_graph_dropdown
require('flash');
require('mini_pipeline_graph_dropdown');
(() => {
describe('Mini Pipeline Graph Dropdown', () => {
......
/* eslint-disable space-before-function-paren, one-var, no-var, one-var-declaration-per-line, no-return-assign, quotes, padded-blocks, max-len */
/* global NewBranchForm */
/*= require jquery-ui/autocomplete */
/*= require new_branch_form */
require('./spec_helper');
require('jquery-ui/ui/autocomplete');
require('new_branch_form');
(function() {
describe('Branch', function() {
......
/* eslint-disable space-before-function-paren, no-unused-expressions, no-var, object-shorthand, comma-dangle, semi, padded-blocks, max-len */
/* global Notes */
/*= require notes */
/*= require autosize */
/*= require gl_form */
/*= require lib/utils/text_utility */
window._ = require('underscore');
require('notes');
require('vendor/autosize');
require('gl_form');
require('lib/utils/text_utility');
(function() {
window.gon || (window.gon = {});
......
//= require pipelines
require('pipelines');
(() => {
describe('Pipelines', () => {
......
//= require lib/utils/pretty_time
require('lib/utils/pretty_time');
(() => {
const PrettyTime = gl.PrettyTime;
......
/* eslint-disable space-before-function-paren, no-unused-expressions, no-return-assign, no-param-reassign, no-var, new-cap, wrap-iife, no-unused-vars, quotes, jasmine/no-expect-in-setup-teardown, padded-blocks, max-len */
/* global Project */
/*= require bootstrap */
/*= require select2 */
/*= require lib/utils/type_utility */
/*= require gl_dropdown */
/*= require api */
/*= require project_select */
/*= require project */
require('./spec_helper');
require('bootstrap/js/dropdown');
require('select2/select2.js');
require