mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
fix unit testing configuration (#1227)
This commit is contained in:
parent
8d97b0b123
commit
ca77608fa3
36
demo-shell-ng2/app/components/home/home.component.spec.ts
Normal file
36
demo-shell-ng2/app/components/home/home.component.spec.ts
Normal file
@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { HomeComponent } from './home.component';
|
||||
import { CoreModule } from 'ng2-alfresco-core';
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreModule],
|
||||
declarations: [HomeComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
});
|
||||
|
||||
it ('should work', () => {
|
||||
let fixture = TestBed.createComponent(HomeComponent);
|
||||
expect(fixture.componentInstance instanceof HomeComponent).toBe(true, 'should create HomeComponent');
|
||||
});
|
||||
});
|
@ -11,7 +11,7 @@ require('zone.js/dist/jasmine-patch');
|
||||
require('zone.js/dist/async-test');
|
||||
require('zone.js/dist/fake-async-test');
|
||||
|
||||
var appContext = require.context('../src', true, /\.spec\.ts/);
|
||||
var appContext = require.context('../app', true, /\.spec\.ts/);
|
||||
|
||||
appContext.keys().forEach(appContext);
|
||||
|
||||
|
@ -24,7 +24,7 @@ module.exports = function (config) {
|
||||
noInfo: true
|
||||
},
|
||||
|
||||
reporters: ['progress'],
|
||||
reporters: ['mocha'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
|
@ -1,18 +1,65 @@
|
||||
var helpers = require('./helpers');
|
||||
var fs = require('fs');
|
||||
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
|
||||
var alfrescoLibs = [
|
||||
helpers.root('node_modules', 'alfresco-js-api'),
|
||||
helpers.root('node_modules', 'ng2-activiti-analytics'),
|
||||
helpers.root('node_modules', 'ng2-activiti-diagrams'),
|
||||
helpers.root('node_modules', 'ng2-activiti-form'),
|
||||
helpers.root('node_modules', 'ng2-activiti-processlist'),
|
||||
helpers.root('node_modules', 'ng2-activiti-tasklist'),
|
||||
helpers.root('node_modules', 'ng2-alfresco-core'),
|
||||
helpers.root('node_modules', 'ng2-alfresco-datatable'),
|
||||
helpers.root('node_modules', 'ng2-alfresco-documentlist'),
|
||||
helpers.root('node_modules', 'ng2-alfresco-login'),
|
||||
helpers.root('node_modules', 'ng2-alfresco-search'),
|
||||
helpers.root('node_modules', 'ng2-alfresco-tag'),
|
||||
helpers.root('node_modules', 'ng2-alfresco-upload'),
|
||||
helpers.root('node_modules', 'ng2-alfresco-userinfo'),
|
||||
helpers.root('node_modules', 'ng2-alfresco-viewer'),
|
||||
helpers.root('node_modules', 'ng2-alfresco-webscript')
|
||||
].map((entry) => fs.realpathSync(entry));
|
||||
|
||||
const rootPath = helpers.root('node_modules');
|
||||
|
||||
module.exports = {
|
||||
devtool: 'inline-source-map',
|
||||
|
||||
resolve: {
|
||||
extensions: ['', '.ts', '.js']
|
||||
extensions: ['', '.ts', '.js'],
|
||||
modules: [
|
||||
helpers.root('app'),
|
||||
helpers.root('node_modules')
|
||||
],
|
||||
alias: {
|
||||
'alfresco-js-api': helpers.root('node_modules', 'alfresco-js-api', 'dist', 'alfresco-js-api.js')
|
||||
},
|
||||
root: rootPath,
|
||||
fallback: rootPath
|
||||
},
|
||||
|
||||
resolveLoader: {
|
||||
alias: {
|
||||
'systemjs-loader': helpers.root('config', 'loaders', 'system.js')
|
||||
},
|
||||
fallback: rootPath
|
||||
},
|
||||
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
exclude: /node_modules/,
|
||||
loaders: ['awesome-typescript-loader', 'angular2-template-loader']
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
include: [
|
||||
...alfrescoLibs
|
||||
],
|
||||
loaders: ['angular2-template-loader', 'source-map-loader', 'systemjs-loader']
|
||||
},
|
||||
{
|
||||
test: /\.html$/,
|
||||
loader: 'html'
|
||||
@ -23,15 +70,14 @@ module.exports = {
|
||||
loader: 'null'
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
exclude: helpers.root('src', 'app'),
|
||||
loader: 'null'
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
include: helpers.root('src', 'app'),
|
||||
loader: 'raw'
|
||||
test: /\.css$/,
|
||||
loader: 'raw'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
node: {
|
||||
fs: 'empty',
|
||||
module: false
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,7 @@
|
||||
"jasmine-core": "^2.4.1",
|
||||
"karma": "^1.2.0",
|
||||
"karma-jasmine": "^1.0.2",
|
||||
"karma-mocha-reporter": "^2.2.1",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^1.8.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user