Skip to content

Commit df63299

Browse files
committed
Don't use ES6 in the test until babel is working, different config for cloud and local
1 parent 45b4964 commit df63299

3 files changed

Lines changed: 93 additions & 6 deletions

File tree

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
"docdash": "^0.4.0",
2424
"filesaver.js": "github:andyinabox/FileSaver.js",
2525
"jasmine": "^2.5.2",
26-
"requirejs": "^2.3.2",
27-
"jsdoc": "^3.4.1"
26+
"jsdoc": "^3.4.1",
27+
"karma-sauce-launcher": "^1.0.0",
28+
"requirejs": "^2.3.2"
2829
},
2930
"devDependencies": {
3031
"babel-preset-es2015-rollup": "^1.1.1",
@@ -43,6 +44,7 @@
4344
"build": "npm install && bower install && node build.js",
4445
"version": "npm run build && git add -A dist",
4546
"test": "./node_modules/.bin/karma start --single-run",
47+
"test-local": "./node_modules/.bin/karma start --single-run",
4648
"generate-docs": "node_modules/.bin/jsdoc -c jsdoc.json"
4749
}
4850
}

saucelabs.karma.conf.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
const browsers = {
2+
sl_chrome: {
3+
base: 'SauceLabs',
4+
browserName: 'chrome',
5+
platform: 'Windows 10',
6+
version: '53'
7+
},
8+
sl_firefox: {
9+
base: 'SauceLabs',
10+
browserName: 'firefox',
11+
version: '49'
12+
},
13+
sl_ios_safari: {
14+
base: 'SauceLabs',
15+
browserName: 'iphone',
16+
platform: 'OS X 10.9',
17+
version: '7.1'
18+
},
19+
sl_ie_11: {
20+
base: 'SauceLabs',
21+
browserName: 'internet explorer',
22+
platform: 'Windows 10',
23+
version: '11'
24+
}
25+
}
26+
27+
module.exports = (config) => {
28+
config.set({
29+
30+
// base path that will be used to resolve all patterns (eg. files, exclude)
31+
basePath: '',
32+
33+
// frameworks to use
34+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
35+
frameworks: ['jasmine'],
36+
37+
// list of files / patterns to load in the browser
38+
files: [
39+
'jspdf.js', {
40+
pattern: 'specs/**/*.spec.js',
41+
included: true
42+
}
43+
],
44+
45+
// list of files to exclude
46+
exclude: [],
47+
48+
// preprocess matching files before serving them to the browser
49+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
50+
preprocessors: {},
51+
52+
// test results reporter to use
53+
// possible values: 'dots', 'progress'
54+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
55+
reporters: ['progress'],
56+
57+
// web server port
58+
port: 9876,
59+
60+
// enable / disable colors in the output (reporters and logs)
61+
colors: true,
62+
63+
// level of logging
64+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
65+
logLevel: config.LOG_INFO,
66+
67+
// enable / disable watching file and executing tests whenever any file changes
68+
autoWatch: false,
69+
70+
// Continuous Integration mode
71+
// if true, Karma captures browsers, runs the tests and exits
72+
singleRun: false,
73+
74+
// Concurrency level
75+
// how many browser should be started simultaneous
76+
concurrency: Infinity,
77+
78+
// all other options that are defined in
79+
// local.karma.conf.js were elided for the
80+
// purpose of this blog post.
81+
reporters: ['saucelabs', 'progress'], // 2
82+
browsers: Object.keys(browsers), // 3
83+
customLaunchers: browsers // 4
84+
})
85+
}

specs/text/standard.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
'use strict'
22
/* global describe, it, expect */
3-
describe('Standard Text', () => {
4-
it('should load', () => {
3+
describe('Standard Text', function() {
4+
it('should load', function() {
55
// assertions here]
66
expect(typeof jsPDF, 'function')
77
})
8-
it('should allow text insertion', () => {
9-
const doc = new jsPDF()
8+
it('should allow text insertion', function() {
9+
var doc = new jsPDF()
1010
doc.text(10, 10, 'This is a test!')
1111
doc.output('dataurlnewwindow')
1212
})

0 commit comments

Comments
 (0)