-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
5,123 additions
and
224 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// /*global jasmine, __karma__, window*/ | ||
Error.stackTraceLimit = 0; | ||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; | ||
|
||
var builtPaths = (__karma__.config.builtPaths || ['dist/']) | ||
.map(function(p) { return '/base/'+p;}); | ||
|
||
__karma__.loaded = function () { }; | ||
|
||
function isJsFile(path) { | ||
return path.slice(-3) == '.js'; | ||
} | ||
|
||
function isSpecFile(path) { | ||
return /\.spec\.(.*\.)?js$/.test(path); | ||
} | ||
|
||
// Is a "built" file if is JavaScript file in one of the "built" folders | ||
function isBuiltFile(path) { | ||
return isJsFile(path) && | ||
builtPaths.reduce(function(keep, bp) { | ||
return keep || (path.substr(0, bp.length) === bp); | ||
}, false); | ||
} | ||
|
||
var allSpecFiles = Object.keys(window.__karma__.files) | ||
.filter(isSpecFile) | ||
.filter(isBuiltFile); | ||
|
||
System.config({ | ||
baseURL: 'base/', | ||
packages: { 'testing': { main: 'index.js', defaultExtension: 'js' } }, | ||
map: { | ||
'@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js', | ||
'@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js', | ||
'@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js', | ||
'@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js', | ||
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js' | ||
}, | ||
}); | ||
|
||
System.import('systemjs.config.js') | ||
.then(initTestBed) | ||
.then(initTesting); | ||
|
||
function initTestBed(){ | ||
return Promise.all([ | ||
System.import('@angular/core/testing'), | ||
System.import('@angular/platform-browser-dynamic/testing') | ||
]) | ||
|
||
.then(function (providers) { | ||
var coreTesting = providers[0]; | ||
var browserTesting = providers[1]; | ||
|
||
coreTesting.TestBed.initTestEnvironment( | ||
browserTesting.BrowserDynamicTestingModule, | ||
browserTesting.platformBrowserDynamicTesting()); | ||
}) | ||
} | ||
|
||
// Import all spec files and start karma | ||
function initTesting () { | ||
return Promise.all( | ||
allSpecFiles.map(function (moduleName) { | ||
return System.import(moduleName); | ||
}) | ||
) | ||
.then(__karma__.start, __karma__.error); | ||
} |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
"use strict"; | ||
|
||
module.exports = config => { | ||
|
||
const conf = { | ||
basePath: '', | ||
frameworks: ['jasmine'], | ||
|
||
plugins: [ | ||
'karma-jasmine', | ||
'karma-chrome-launcher', | ||
'karma-phantomjs-launcher', | ||
'karma-jasmine-html-reporter', | ||
'karma-babel-preprocessor', | ||
], | ||
|
||
preprocessors: { | ||
'dist/**/*.js': ['babel'] | ||
}, | ||
|
||
babelPreprocessor: { | ||
options: { | ||
presets: ['es2015'], | ||
} | ||
}, | ||
|
||
customLaunchers: { | ||
Chrome_travis_ci: { | ||
base: 'Chrome', | ||
flags: ['--no-sandbox'] | ||
} | ||
}, | ||
|
||
files: [ | ||
'node_modules/babel-polyfill/dist/polyfill.js', | ||
'node_modules/systemjs/dist/system.src.js', | ||
|
||
// Polyfills | ||
'node_modules/core-js/client/shim.js', | ||
|
||
// zone.js | ||
'node_modules/zone.js/dist/zone.js', | ||
'node_modules/zone.js/dist/long-stack-trace-zone.js', | ||
'node_modules/zone.js/dist/proxy.js', | ||
'node_modules/zone.js/dist/sync-test.js', | ||
'node_modules/zone.js/dist/jasmine-patch.js', | ||
'node_modules/zone.js/dist/async-test.js', | ||
'node_modules/zone.js/dist/fake-async-test.js', | ||
|
||
{pattern: 'karma-test-shim.js', included: true, watched: true}, | ||
|
||
// paths loaded via module imports | ||
{pattern: 'dist/**/*.js', included: false, watched: true}, | ||
|
||
// paths to support debugging with source maps in dev tools | ||
{pattern: 'src/**/*.ts', included: false, watched: false}, | ||
{pattern: 'dist/**/*.js.map', included: false, watched: false}, | ||
|
||
// RxJs | ||
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false }, | ||
{ pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false }, | ||
|
||
// Paths loaded via module imports: | ||
// Angular itself | ||
{ pattern: 'node_modules/@angular/**/*.js', included: false, watched: false }, | ||
{ pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false }, | ||
|
||
{ pattern: 'systemjs.config.js', included: false, watched: false } | ||
], | ||
|
||
// Proxied base paths for loading assets | ||
proxies: { | ||
'/dist/': '/base/dist/' | ||
}, | ||
exclude: [], | ||
reporters: ['progress', 'kjhtml'], | ||
|
||
port: 9876, | ||
colors: true, | ||
logLevel: config.INFO, | ||
autoWatch: true, | ||
browsers: ['PhantomJS'], | ||
singleRun: false | ||
}; | ||
|
||
if (process.env.SAUCE) { | ||
|
||
// Browsers to run on Sauce Labs | ||
const customLaunchers = { | ||
sl_chrome: { | ||
base: 'SauceLabs', | ||
browserName: 'chrome', | ||
platform: 'Windows 10', | ||
version: '49' | ||
}, | ||
sl_firefox_dev: { | ||
base: 'SauceLabs', | ||
browserName: 'firefox', | ||
platform: 'Windows 10', | ||
version: 'dev' | ||
}, | ||
sl_firefox_52: { | ||
base: 'SauceLabs', | ||
browserName: 'firefox', | ||
platform: 'Windows 10', | ||
version: '52' | ||
}, | ||
sl_firefox_40: { | ||
base: 'SauceLabs', | ||
browserName: 'firefox', | ||
platform: 'Windows 10', | ||
version: '40' | ||
}, | ||
sl_ie_11: { | ||
base: 'SauceLabs', | ||
browserName: 'internet explorer', | ||
platform: 'Windows 7', | ||
version: '11' | ||
}, | ||
sl_ie_10: { | ||
base: 'SauceLabs', | ||
browserName: 'internet explorer', | ||
platform: 'Windows 7', | ||
version: '10' | ||
}, | ||
sl_edge: { | ||
base: 'SauceLabs', | ||
browserName: 'MicrosoftEdge', | ||
platform: 'Windows 10', | ||
version: '14' | ||
}, | ||
sl_android_5: { | ||
base: 'SauceLabs', | ||
browserName: 'android', | ||
platform: 'Linux', | ||
version: '5.1' | ||
}, | ||
'sl_android_4.4': { | ||
base: 'SauceLabs', | ||
browserName: 'android', | ||
platform: 'Linux', | ||
version: '4.4' | ||
}, | ||
sl_safari: { | ||
base: 'SauceLabs', | ||
browserName: 'safari', | ||
platform: 'macOS 10.12', | ||
version: '10' | ||
} | ||
}; | ||
|
||
conf.plugins.push('karma-sauce-launcher'); | ||
conf.reporters = ['saucelabs', 'dots']; | ||
conf.sauceLabs = { | ||
testName: 'ng2-facebook-sdk', | ||
public: 'public', | ||
recordScreenshots: false, | ||
startConnect: false, | ||
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER | ||
}; | ||
conf.customLaunchers = customLaunchers; | ||
conf.browsers = Object.keys(customLaunchers); | ||
conf.singleRun = true; | ||
conf.concurrency = 5; | ||
conf.browserDisconnectTolerance = 2; | ||
conf.browserNoActivityTimeout = 20000; | ||
conf.browserDisconnectTimeout = 5000; | ||
} | ||
|
||
config.set(conf); | ||
|
||
}; |
Oops, something went wrong.