Last active
December 4, 2019 08:09
Revisions
-
Gorm Casper revised this gist
Apr 2, 2015 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,12 @@ /** * * This file is auto generated when you run * karma init test/karma.conf.js * * I only included it here for you to see. * */ // Karma configuration module.exports = function(config) { -
Gorm Casper revised this gist
Apr 1, 2015 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,10 @@ /** * I couldn't find a super simple example of how to run Karma, PhantomJs, with * Jasmine tests via npm, so eventually I decided to create my own. Maybe * someone will find it useful. * * * Installation (using npm): * * npm install -g karma-cli * npm install -g karma --save-dev -
Gorm Casper created this gist
Apr 1, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ /** * * Instalation (using npm): * * npm install -g karma-cli * npm install -g karma --save-dev * npm install -g phantomjs * npm install -g karma-jasmine --save-dev * npm install -g karma-phantomjs-launcher --save-dev * * * file structure: * * index.js // This file * test/ * karma.conf.js // This is auto generated * test.js * * * Once everything is installed, you run: * * karma init test/karma.conf.js * * And to run the actual tests: * * karma start test/karma.conf.js * * * Below is just an object with some functions that are easy to test. * */ var dummy = { aboveFive: function (n) { return n > 5; }, setClass: function (el, classname) { el.className = classname; } }; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ // Karma configuration module.exports = function(config) { config.set({ // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '..', // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'], // list of files / patterns to load in the browser files: [ 'index.js', 'test/test.js' ], // list of files to exclude exclude: [ ], // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { }, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['progress'], // web server port port: 9876, // enable / disable colors in the output (reporters and logs) colors: true, // level of logging // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG logLevel: config.LOG_INFO, // enable / disable watching file and executing tests whenever any file changes autoWatch: true, // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['PhantomJS'], // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: false }); }; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ /* globals describe, it, expect, dummy */ describe('Checking that everything is hooked up nicely', function () { it('Simple function', function () { expect(dummy.aboveFive(2)).toEqual(false); }); it('involving the dom', function () { var el = document.createElement('span'); dummy.setClass(el, 'foo'); expect(el.className).toBe('foo'); }); });