Переглянути джерело

testing saucelabs

tags/3.0.0
dotnetCarpenter 5 роки тому
джерело
коміт
85cc7cc130
Аккаунт користувача з таким Email не знайдено
6 змінених файлів з 247 додано та 240 видалено
  1. 66
    0
      .config/karma.conf.common.js
  2. 45
    93
      .config/karma.conf.js
  3. 130
    0
      .config/karma.conf.saucelabs.js
  4. 6
    1
      dist/svg.js
  5. 0
    1
      dist/svg.js.map
  6. 0
    145
      gulpfile.js

+ 66
- 0
.config/karma.conf.common.js Переглянути файл

@@ -0,0 +1,66 @@
// Karma shared configuration

const os = require('os')
const cpuCount = os.cpus().length

module.exports = function (config) {
return {
// 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: [
'.config/pretest.js',
'spec/RAFPlugin.js',
{
pattern: 'spec/fixtures/fixture.css',
included: false,
served: true
},
{
pattern: 'spec/fixtures/fixture.svg',
included: false,
served: true
},
{
pattern: 'spec/fixtures/pixel.png',
included: false,
served: true
},
'dist/svg.js',
'spec/spec/**/*.js'
],

proxies: {
'/fixtures/': '/base/spec/fixtures/'
},

// 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: false,

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: cpuCount || Infinity,

// list of files to exclude
exclude: [],
}
}

+ 45
- 93
.config/karma.conf.js Переглянути файл

@@ -1,101 +1,53 @@
// Karma configuration
// Generated on Tue Oct 04 2016 13:53:46 GMT+0200 (CEST)

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'],
const karmaCommon = require('./karma.conf.common.js')

let chromeBin = 'ChromeHeadless'
if (process.platform === 'linux') {
// We need to choose either Chrome or Chromium.
// Canary is not available on linux.
// If we do not find Chromium then we can deduce that
// either Chrome is installed or there is no Chrome variant at all,
// in which case karma-chrome-launcher will output an error.
// If `which` finds nothing it will throw an error.
const { execSync } = require('child_process')

try {
if (execSync('which chromium-browser')) chromeBin = 'ChromiumHeadless'
} catch (e) {}
}

module.exports = function (config) {
config.set(
Object.assign(karmaCommon(config), {
// list of files to exclude
exclude: [],

// list of files / patterns to load in the browser
files: [
'.config/pretest.js',
'spec/RAFPlugin.js',
{
pattern: 'spec/fixtures/fixture.css',
included: false,
served: true
},
{
pattern: 'spec/fixtures/fixture.svg',
included: false,
served: true
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'dist/svg.js': ['coverage']
},
{
pattern: 'spec/fixtures/pixel.png',
included: false,
served: true
},
'dist/svg.js',
'spec/spec/**/*.js'
],

proxies: {
'/fixtures/': '/base/spec/fixtures/'
},


// 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: {
'dist/svg.js': ['coverage']
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage'],


// configure the coverage reporter
coverageReporter: {
// Specify a reporter type.
type: 'lcov',
dir: 'coverage/',
subdir: function(browser) {
// normalization process to keep a consistent browser name accross different OS
return browser.toLowerCase().split(/[ /-]/)[0]; // output the results into: './coverage/firefox/'
}
},


// 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: false,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [process.platform === 'linux' ? 'ChromiumHeadless' : 'ChromeHeadless', 'FirefoxHeadless'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage'],

// configure the coverage reporter
coverageReporter: {
// Specify a reporter type.
type: 'lcov',
dir: 'coverage/',
subdir: function(browser) {
// normalization process to keep a consistent browser name accross different OS
return browser.toLowerCase().split(/[ /-]/)[0]; // output the results into: './coverage/firefox/'
}
},

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [chromeBin, 'FirefoxHeadless'],
})
)
}

+ 130
- 0
.config/karma.conf.saucelabs.js Переглянути файл

@@ -0,0 +1,130 @@
// Karma configuration
// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator

const karmaCommon = require('./karma.conf.common.js')

const SauceLabsLaunchers = {
/** Real mobile devices are not available
* Your account does not have access to Android devices.
* Please contact sales@saucelabs.com to add this feature to your account.*/
/*sl_android_chrome: {
base: 'SauceLabs',
appiumVersion: '1.5.3',
deviceName: 'Samsung Galaxy S7 Device',
deviceOrientation: 'portrait',
browserName: 'Chrome',
platformVersion: '6.0',
platformName: 'Android'
},*/
sl_android: {
base: 'SauceLabs',
browserName: 'Android',
deviceName: 'Android Emulator',
deviceOrientation: 'portrait'
},
sl_firefox: {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest'
},
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest'
},
sl_windows_edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
version: 'latest',
platform: 'Windows 10'
},
sl_macos_safari: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'macOS 10.13',
version: '12.0',
recordVideo: true,
recordScreenshots: true,
screenResolution: '1024x768'
}/*,
sl_macos_iphone: {
base: 'SauceLabs',
browserName: 'Safari',
deviceName: 'iPhone SE Simulator',
deviceOrientation: 'portrait',
platformVersion: '10.2',
platformName: 'iOS'
}*/
}


module.exports = function(config) {

if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
console.error("SAUCE_USERNAME and SAUCE_ACCESS_KEY must be provided as environment variables.")
console.warn("Aborting Sauce Labs test")
process.exit(1)
}

config.set(

Object.assign(karmaCommon, {
// Concurrency level
// how many browser should be started simultaneous
// Saucelabs allow up to 5 concurrent sessions on the free open source tier.
concurrency: 5,

// this specifies which plugins karma should load
// by default all karma plugins, starting with `karma-` will load
// so if you are really puzzled why something isn't working, then comment
// out plugins: [] - it's here to make karma load faster
// get possible karma plugins by `ls node_modules | grep 'karma-*'`
plugins: [
'karma-coverage',
'karma-jasmine',
'karma-sauce-launcher',
'karma-spec-reporter'
],

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec', 'saucelabs'],

specReporter: {
maxLogLines: 5, // limit number of lines logged per test
suppressErrorSummary: false,// do print error summary
suppressFailed: false, // do print information about failed tests
suppressPassed: true, // do not print information about passed tests
suppressSkipped: true, // do not print information about skipped tests
showSpecTiming: true, // print the time elapsed for each spec
failFast: false // test would finish with error when a first fail occurs.
},

customLaunchers: SauceLabsLaunchers,

// start these browsers
browsers: Object.keys(SauceLabsLaunchers),
sauceLabs: {
testName: 'SVG.js Unit Tests',
connectOptions: {
noSslBumpDomains: "all"
}
},

// The number of disconnections tolerated.
browserDisconnectTolerance: 0, // well, sometimes it helps to just restart
// How long does Karma wait for a browser to reconnect (in ms).
browserDisconnectTimeout: 10 * 60 * 1000,
// How long will Karma wait for a message from a browser before disconnecting from it (in ms). ~ macOS 10.12 needs more than 7 minutes
browserNoActivityTimeout: 20 * 60 * 1000,
// Timeout for capturing a browser (in ms). On newer versions of iOS simulator (10.0+), the start up time could be between 3 - 6 minutes.
captureTimeout: 12 * 60 * 1000, // this is useful if saucelabs takes a long time to boot a vm

// Required to make Safari on Sauce Labs play nice.
hostname: 'karmalocal.dev'
})

)

}

+ 6
- 1
dist/svg.js Переглянути файл

@@ -6,7 +6,7 @@
* @copyright Wout Fierens <wout@mick-wout.com>
* @license MIT
*
* BUILT: Thu Nov 08 2018 19:44:36 GMT+0100 (GMT+01:00)
* BUILT: Mon Nov 12 2018 00:35:39 GMT+0100 (CET)
*/;
var SVG = (function () {
'use strict';
@@ -1759,6 +1759,7 @@ var SVG = (function () {
extend(Dom, {
attr: attr
});
register(Dom);

var Doc = getClass(root);

@@ -1914,6 +1915,7 @@ var SVG = (function () {

return Element;
}(Dom);
register(Element);

var Container =
/*#__PURE__*/
@@ -1951,6 +1953,7 @@ var SVG = (function () {

return Container;
}(Element);
register(Container);

var Defs =
/*#__PURE__*/
@@ -5356,6 +5359,7 @@ var SVG = (function () {

return Shape;
}(Element);
register(Shape);

var Circle =
/*#__PURE__*/
@@ -6785,6 +6789,7 @@ var SVG = (function () {
return this.put(new Style()).font(name, src, params);
})
});
register(Style);

var _Symbol =
/*#__PURE__*/

+ 0
- 1
dist/svg.js.map
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 0
- 145
gulpfile.js Переглянути файл

@@ -1,145 +0,0 @@
var del = require('del'),
gulp = require('gulp'),
chmod = require('gulp-chmod'),
concat = require('gulp-concat'),
header = require('gulp-header'),
rename = require('gulp-rename'),
size = require('gulp-size'),
trim = require('gulp-trimlines'),
uglify = require('gulp-uglify'),
wrapUmd = require('gulp-wrap'),
pkg = require('./package.json'),
standard = require('gulp-standard'),
babel = require('gulp-babel'),
sourcemaps = require('gulp-sourcemaps')
var headerLong = ['/*!',
'* <%= pkg.name %> - <%= pkg.description %>',
'* @version <%= pkg.version %>',
'* <%= pkg.homepage %>',
'*',
'* @copyright <%= pkg.author %>',
'* @license <%= pkg.license %>',
'*',
'* BUILT: <%= pkg.buildDate %>',
'*/;',
''].join('\n')
var headerShort = '/*! <%= pkg.name %> v<%= pkg.version %> <%= pkg.license %>*/;'
// all files in the right order (currently we don't use any dependency management system)
var parts = [
'src/svg.js',
'src/regex.js',
'src/utilities.js',
'src/default.js',
'src/queue.js',
'src/drawLoop.js',
'src/color.js',
'src/array.js',
'src/pointarray.js',
'src/patharray.js',
'src/number.js',
'src/eventtarget.js',
'src/HtmlNode.js',
'src/element.js',
'src/event.js',
'src/matrix.js',
'src/point.js',
'src/attr.js',
'src/transform.js',
'src/css.js',
'src/parent.js',
'src/flatten.js',
'src/container.js',
'src/defs.js',
'src/group.js',
'src/arrange.js',
'src/mask.js',
'src/clip.js',
'src/gradient.js',
'src/pattern.js',
'src/doc.js',
'src/shape.js',
'src/bare.js',
'src/symbol.js',
'src/use.js',
'src/rect.js',
'src/ellipse.js',
'src/line.js',
'src/poly.js',
'src/pointed.js',
'src/path.js',
'src/image.js',
'src/text.js',
'src/textpath.js',
'src/hyperlink.js',
'src/marker.js',
'src/sugar.js',
'src/set.js',
'src/data.js',
'src/memory.js',
'src/selector.js',
'src/helpers.js',
'src/polyfill.js',
'src/boxes.js',
'src/parser.js',
'src/animator.js',
'src/morph.js',
'src/runner.js',
'src/timeline.js',
'src/controller.js'
]
gulp.task('clean', function () {
return del([ 'dist/*' ])
})
gulp.task('lint', function () {
return gulp.src(parts)
.pipe(standard())
.pipe(standard.reporter('default', {
showRuleNames: true,
breakOnError: process.argv[2] !== "--dont-break",
quiet: true,
}))
})
/**
* Compile everything in /src to one unified file in the order defined in the MODULES constant
* wrap the whole thing in a UMD wrapper (@see https://github.com/umdjs/umd)
* add the license information to the header plus the build time stamp‏
*/
gulp.task('unify', ['clean', 'lint'], function () {
pkg.buildDate = Date()
return gulp.src(parts)
.pipe(sourcemaps.init())
.pipe(concat('svg.js', { newLine: '\n' }))
.pipe(babel({presets: ['@babel/env']}))
// wrap the whole thing in an immediate function call
.pipe(wrapUmd({src: 'src/umd.js'}))
.pipe(header(headerLong, { pkg: pkg }))
.pipe(trim({ leading: false }))
.pipe(chmod(0o644))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'))
.pipe(size({ showFiles: true, title: 'Full' }))
})
/**
‎* uglify the file and show the size of the result
* add the license info
* show the gzipped file size
*/
gulp.task('minify', ['unify'], function () {
return gulp.src('dist/svg.js')
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(size({ showFiles: true, title: 'Minified' }))
.pipe(header(headerShort, { pkg: pkg }))
.pipe(chmod(0o644))
.pipe(gulp.dest('dist'))
.pipe(size({ showFiles: true, gzip: true, title: 'Gzipped' }))
})
gulp.task('default', ['clean', 'unify', 'minify'])

Завантаження…
Відмінити
Зберегти