Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Store
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Moecube Store
Commits
6c060f10
Commit
6c060f10
authored
May 04, 2016
by
Foxandxss
Committed by
Ward Bell
May 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: enable testing for rc1
closes issue #86
parent
a93c713a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
128 deletions
+116
-128
app/app.component.spec.ts
app/app.component.spec.ts
+8
-6
karma-test-shim.js
karma-test-shim.js
+64
-81
karma.conf.js
karma.conf.js
+8
-10
wallaby.js
wallaby.js
+36
-31
No files found.
app/app.component.spec.ts
.not.yet
→
app/app.component.spec.ts
View file @
6c060f10
...
@@ -5,13 +5,15 @@ import {
...
@@ -5,13 +5,15 @@ import {
expect
,
it
,
iit
,
xit
,
expect
,
it
,
iit
,
xit
,
describe
,
ddescribe
,
xdescribe
,
describe
,
ddescribe
,
xdescribe
,
beforeEach
,
beforeEachProviders
,
withProviders
,
beforeEach
,
beforeEachProviders
,
withProviders
,
async, inject
, TestComponentBuilder
async
,
inject
} from '
angular2
/testing';
}
from
'
@angular/core
/testing
'
;
import { By } from 'angular2/platform/browser';
import
{
TestComponentBuilder
}
from
'
@angular/compiler/testing
'
;
import { provide } from 'angular2/core';
import { ViewMetadata } from 'angular2/core';
import
{
By
}
from
'
@angular/platform-browser
'
;
import { PromiseWrapper } from 'angular2/src/facade/promise';
import
{
provide
}
from
'
@angular/core
'
;
import
{
ViewMetadata
}
from
'
@angular/core
'
;
import
{
PromiseWrapper
}
from
'
@angular/core/src/facade/promise
'
;
//////// SPECS /////////////
//////// SPECS /////////////
...
...
karma-test-shim.js
View file @
6c060f10
/*global jasmine, __karma__, window*/
// /*global jasmine, __karma__, window*/
(
function
()
{
Error
.
stackTraceLimit
=
Infinity
;
// Error.stackTraceLimit = Infinity;
jasmine
.
DEFAULT_TIMEOUT_INTERVAL
=
1000
;
jasmine
.
DEFAULT_TIMEOUT_INTERVAL
=
1000
;
// Cancel Karma's synchronous start,
__karma__
.
loaded
=
function
()
{
// we call `__karma__.start()` later, once all the specs are loaded.
};
__karma__
.
loaded
=
function
()
{
};
// SET THE RUNTIME APPLICATION ROOT HERE
var
appRoot
=
'
app
'
;
// no trailing slash!
// RegExp for client application base path within karma (which always starts 'base\')
function
isJsFile
(
path
)
{
var
karmaBase
=
'
^
\
/base
\
/
'
;
// RegEx string for base of karma folders
return
path
.
slice
(
-
3
)
==
'
.js
'
;
var
appPackage
=
'
base/
'
+
appRoot
;
//e.g., base/app
}
var
appRootRe
=
new
RegExp
(
karmaBase
+
appRoot
+
'
\
/
'
);
var
onlyAppFilesRe
=
new
RegExp
(
karmaBase
+
appRoot
+
'
\
/(?!.*
\
.spec
\
.js$)([a-z0-9-_
\
.
\
/]+)
\
.js$
'
);
var
moduleNames
=
[];
function
isSpecFile
(
path
)
{
return
/
\.
spec
\.
js$/
.
test
(
path
);
}
// Configure systemjs packages to use the .js extension for imports from the app folder
function
isBuiltFile
(
path
)
{
var
packages
=
{};
var
builtPath
=
'
/base/app/
'
;
packages
[
appPackage
]
=
{
return
isJsFile
(
path
)
&&
(
path
.
substr
(
0
,
builtPath
.
length
)
==
builtPath
);
defaultExtension
:
false
,
}
format
:
'
register
'
,
map
:
Object
.
keys
(
window
.
__karma__
.
files
)
.
filter
(
onlyAppFiles
)
// Create local module name mapping to karma file path for app files
// with karma's fingerprint in query string, e.g.:
// './hero.service': '/base/app/hero.service.js?f4523daf879cfb7310ef6242682ccf10b2041b3e'
.
reduce
(
function
(
pathsMapping
,
appPath
)
{
var
moduleName
=
appPath
.
replace
(
appRootRe
,
'
./
'
).
replace
(
/
\.
js$/
,
''
);
pathsMapping
[
moduleName
]
=
appPath
+
'
?
'
+
window
.
__karma__
.
files
[
appPath
];
return
pathsMapping
;
},
{})
}
System
.
config
({
packages
:
packages
});
var
allSpecFiles
=
Object
.
keys
(
window
.
__karma__
.
files
)
.
filter
(
isSpecFile
)
.
filter
(
isBuiltFile
);
// Load our SystemJS configuration.
var
packages
=
{
'
app
'
:
{
main
:
'
main.js
'
,
defaultExtension
:
'
js
'
},
'
rxjs
'
:
{
defaultExtension
:
'
js
'
},
};
// Add angular packages to SystemJS config
[
'
@angular/common
'
,
'
@angular/compiler
'
,
'
@angular/core
'
,
'
@angular/http
'
,
'
@angular/platform-browser
'
,
'
@angular/platform-browser-dynamic
'
,
'
@angular/router
'
,
'
@angular/router-deprecated
'
,
'
@angular/upgrade
'
].
forEach
(
function
(
name
)
{
packages
[
name
]
=
{
main
:
'
index.js
'
,
defaultExtension
:
'
js
'
};});
System
.
config
({
baseURL
:
'
/base
'
,
map
:
{
'
rxjs
'
:
'
node_modules/rxjs
'
,
'
@angular
'
:
'
node_modules/@angular
'
,
'
app
'
:
'
app
'
},
packages
:
packages
});
Promise
.
all
([
System
.
import
(
'
@angular/core/testing
'
),
System
.
import
(
'
@angular/platform-browser-dynamic/testing
'
)
]).
then
(
function
(
providers
)
{
var
testing
=
providers
[
0
];
var
testingBrowser
=
providers
[
1
];
// Configure Angular for the browser and
// with test versions of the platform providers
Promise
.
all
([
System
.
import
(
'
angular2/testing
'
),
System
.
import
(
'
angular2/platform/testing/browser
'
)
])
.
then
(
function
(
results
)
{
var
testing
=
results
[
0
];
var
browser
=
results
[
1
];
testing
.
setBaseTestProviders
(
testing
.
setBaseTestProviders
(
browser
.
TEST_BROWSER
_PLATFORM_PROVIDERS
,
testingBrowser
.
TEST_BROWSER_DYNAMIC
_PLATFORM_PROVIDERS
,
browser
.
TEST_BROWSER
_APPLICATION_PROVIDERS
);
testingBrowser
.
TEST_BROWSER_DYNAMIC
_APPLICATION_PROVIDERS
);
// Load all spec files
}).
then
(
function
()
{
// (e.g. 'base/app/hero.service.spec.js')
// Finally, load all spec files.
// This will run the tests directly.
return
Promise
.
all
(
return
Promise
.
all
(
Object
.
keys
(
window
.
__karma__
.
files
)
allSpecFiles
.
map
(
function
(
moduleName
)
{
.
filter
(
onlySpecFiles
)
.
map
(
function
(
moduleName
)
{
moduleNames
.
push
(
moduleName
);
return
System
.
import
(
moduleName
);
return
System
.
import
(
moduleName
);
}));
}));
})
}).
then
(
__karma__
.
start
,
__karma__
.
error
);
.
then
(
success
,
fail
);
////// Helpers //////
function
onlyAppFiles
(
filePath
)
{
return
onlyAppFilesRe
.
test
(
filePath
);
}
function
onlySpecFiles
(
filePath
)
{
return
/
\.
spec
\.
js$/
.
test
(
filePath
);
}
function
success
()
{
console
.
log
(
'
Spec files loaded:
\n
'
+
moduleNames
.
join
(
'
\n
'
)
+
'
\n
Starting Jasmine testrunner
'
);
__karma__
.
start
();
}
function
fail
(
error
)
{
__karma__
.
error
(
error
.
stack
||
error
);
}
})();
karma.conf.js
View file @
6c060f10
...
@@ -27,23 +27,21 @@ module.exports = function(config) {
...
@@ -27,23 +27,21 @@ module.exports = function(config) {
// Polyfills
// Polyfills
'
node_modules/es6-shim/es6-shim.js
'
,
'
node_modules/es6-shim/es6-shim.js
'
,
'
node_modules/angular2/bundles/angular2-polyfills.js
'
,
//
Zone.js dependencie
s
//
Reflect and Zone.j
s
// Note - do not include zone.js itself or long-stack-trace-zone.js` here as
'
node_modules/reflect-metadata/Reflect.js
'
,
// they are included already in angular2-polyfills
'
node_modules/zone.js/dist/zone.js
'
,
'
node_modules/zone.js/dist/jasmine-patch.js
'
,
'
node_modules/zone.js/dist/jasmine-patch.js
'
,
'
node_modules/zone.js/dist/async-test.js
'
,
'
node_modules/zone.js/dist/async-test.js
'
,
'
node_modules/zone.js/dist/fake-async-test.js
'
,
'
node_modules/zone.js/dist/fake-async-test.js
'
,
// RxJs
// RxJs.
'
node_modules/rxjs/bundles/Rx.js
'
,
{
pattern
:
'
node_modules/rxjs/**/*.js
'
,
included
:
false
,
watched
:
false
},
{
pattern
:
'
node_modules/rxjs/**/*.js.map
'
,
included
:
false
,
watched
:
false
},
// Angular 2 itself and the testing library
// Angular 2 itself and the testing library
'
node_modules/angular2/bundles/angular2.js
'
,
{
pattern
:
'
node_modules/@angular/**/*.js
'
,
included
:
false
,
watched
:
false
},
'
node_modules/angular2/bundles/router.dev.js
'
,
{
pattern
:
'
node_modules/@angular/**/*.js.map
'
,
included
:
false
,
watched
:
false
},
'
node_modules/angular2/bundles/http.dev.js
'
,
'
node_modules/angular2/bundles/testing.dev.js
'
,
'
karma-test-shim.js
'
,
'
karma-test-shim.js
'
,
...
...
wallaby.js
View file @
6c060f10
...
@@ -11,17 +11,15 @@ module.exports = function () {
...
@@ -11,17 +11,15 @@ module.exports = function () {
// Polyfills
// Polyfills
{
pattern
:
'
node_modules/es6-shim/es6-shim.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/es6-shim/es6-shim.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/angular2/bundles/angular2-polyfills.js
'
,
instrument
:
false
},
// Zone.js dependencies
// Reflect, Zone.js, and test shims
// Note - do not include zone.js itself or long-stack-trace-zone.js` here as
// Rx.js, Angular 2 itself, and the testing library not here because loaded by systemjs
// they are included already in angular2-polyfills
{
pattern
:
'
node_modules/reflect-metadata/Reflect.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/zone.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/jasmine-patch.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/jasmine-patch.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/async-test.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/async-test.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/fake-async-test.js
'
,
instrument
:
false
},
{
pattern
:
'
node_modules/zone.js/dist/fake-async-test.js
'
,
instrument
:
false
},
// Rx.js, Angular 2 itself, and the testing library not here because loaded by systemjs
{
pattern
:
'
app/**/*+(ts|html|css)
'
,
load
:
false
},
{
pattern
:
'
app/**/*+(ts|html|css)
'
,
load
:
false
},
{
pattern
:
'
app/**/*.spec.ts
'
,
ignore
:
true
}
{
pattern
:
'
app/**/*.spec.ts
'
,
ignore
:
true
}
],
],
...
@@ -39,38 +37,45 @@ module.exports = function () {
...
@@ -39,38 +37,45 @@ module.exports = function () {
bootstrap
:
function
(
wallaby
)
{
bootstrap
:
function
(
wallaby
)
{
wallaby
.
delayStart
();
wallaby
.
delayStart
();
var
packages
=
{
'
app
'
:
{
main
:
'
main.js
'
,
defaultExtension
:
'
js
'
},
'
rxjs
'
:
{
defaultExtension
:
'
js
'
},
};
// Add angular packages to SystemJS config
[
'
@angular/common
'
,
'
@angular/compiler
'
,
'
@angular/core
'
,
'
@angular/http
'
,
'
@angular/platform-browser
'
,
'
@angular/platform-browser-dynamic
'
,
'
@angular/router
'
,
'
@angular/router-deprecated
'
,
'
@angular/upgrade
'
].
forEach
(
function
(
name
)
{
packages
[
name
]
=
{
main
:
'
index.js
'
,
defaultExtension
:
'
js
'
};});
System
.
config
({
System
.
config
({
defaultJSExtensions
:
true
,
packages
:
{
app
:
{
meta
:
{
'
*
'
:
{
scriptLoad
:
true
}
}
}
},
paths
:
{
'
npm:*
'
:
'
node_modules/*
'
},
map
:
{
map
:
{
'
angular2
'
:
'
npm:angular2
'
,
'
rxjs
'
:
'
node_modules/rxjs
'
,
'
rxjs
'
:
'
npm:rxjs
'
'
@angular
'
:
'
node_modules/@angular
'
,
}
'
app
'
:
'
app
'
},
packages
:
packages
});
});
// Configure Angular for the browser and
// with test versions of the platform providers
Promise
.
all
([
Promise
.
all
([
System
.
import
(
'
angular2
/testing
'
),
System
.
import
(
'
@angular/core
/testing
'
),
System
.
import
(
'
angular2/platform/testing/browser
'
)
System
.
import
(
'
@angular/platform-browser-dynamic/testing
'
)
])
])
.
then
(
function
(
results
)
{
.
then
(
function
(
providers
)
{
var
testing
=
results
[
0
];
var
testing
=
providers
[
0
];
var
browser
=
results
[
1
];
var
testingBrowser
=
providers
[
1
];
testing
.
setBaseTestProviders
(
testing
.
setBaseTestProviders
(
browser
.
TEST_BROWSER_PLATFORM_PROVIDERS
,
testingBrowser
.
TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS
,
browser
.
TEST_BROWSER_APPLICATION_PROVIDERS
);
testingBrowser
.
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
);
// Load all spec files
// Load all spec files
return
Promise
.
all
(
wallaby
.
tests
.
map
(
function
(
specFile
)
{
return
Promise
.
all
(
wallaby
.
tests
.
map
(
function
(
specFile
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment