diff --git a/ng2-components/ng2-alfresco-documentlist/karma-test-shim.js b/ng2-components/ng2-alfresco-documentlist/karma-test-shim.js new file mode 100644 index 0000000000..4433582c6b --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/karma-test-shim.js @@ -0,0 +1,73 @@ +// Tun on full stack traces in errors to help debugging +Error.stackTraceLimit = Infinity; + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; + +// // Cancel Karma's synchronous start, +// // we will call `__karma__.start()` later, once all the specs are loaded. +__karma__.loaded = function() {}; + +System.config({ + packages: { + 'base/dist': { + defaultExtension: 'js', + format: 'register', + map: Object.keys(window.__karma__.files).filter(onlyAppFiles).reduce(createPathRecords, {}) + }, + 'ng2-alfresco-services': { + defaultExtension: 'js' + } + }, + map: { + 'ng2-alfresco-core': '/base/dist/node_modules/ng2-alfresco-core' + } +}); + +System.import('angular2/src/platform/browser/browser_adapter') + .then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); }) + .then(function() { return Promise.all(resolveTestFiles()); }) + .then( + function() { + __karma__.start(); + }, + function(error) { + __karma__.error(error.stack || error); + } + ); + +function createPathRecords(pathsMapping, appPath) { + // creates local module name mapping to global path with karma's fingerprint in path, e.g.: + // './vg-player/vg-player': + // '/base/dist/vg-player/vg-player.js?f4523daf879cfb7310ef6242682ccf10b2041b3e' + var moduleName = './' + resolveKeyPathForMapping('base/dist/', appPath); + moduleName = moduleName.replace(/\.js$/, ''); + pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath]; + return pathsMapping; +} + +function onlyAppFiles(filePath) { + return /\/base\/dist\/(?!.*\.spec\.js$).*\.js$/.test(filePath); +} + +function onlySpecFiles(path) { + return /\.spec\.js$/.test(path); +} + +function resolveTestFiles() { + return Object.keys(window.__karma__.files) // All files served by Karma. + .filter(onlySpecFiles) + .map(function(moduleName) { + // loads all spec files via their global module names (e.g. + // 'base/dist/vg-player/vg-player.spec') + return System.import(moduleName); + }); +} + +function resolveKeyPathForMapping(basePathWhereToStart, appPath) { + var location = appPath.indexOf(basePathWhereToStart); + if (location > -1) { + return appPath.substring(basePathWhereToStart.length + 1); + } else { + return appPath; + } +} diff --git a/ng2-components/ng2-alfresco-documentlist/karma.conf.js b/ng2-components/ng2-alfresco-documentlist/karma.conf.js index 1137484dcf..56d729a45e 100644 --- a/ng2-components/ng2-alfresco-documentlist/karma.conf.js +++ b/ng2-components/ng2-alfresco-documentlist/karma.conf.js @@ -1,129 +1,68 @@ -// Karma configuration -// Generated on Wed Jul 15 2015 09:44:02 GMT+0200 (Romance Daylight Time) -'use strict'; - -var argv = require('yargs').argv; - module.exports = function(config) { config.set({ - // base path that will be used to resolve all patterns (eg. files, exclude) - basePath: './', + 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: [ - 'node_modules/zone.js/dist/zone.js', - 'node_modules/zone.js/dist/long-stack-trace-zone.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', - 'node_modules/es6-module-loader/dist/es6-module-loader.js', - 'node_modules/traceur/bin/traceur-runtime.js', // Required by PhantomJS2, otherwise it shouts ReferenceError: Can't find variable: require - 'node_modules/traceur/bin/traceur.js', - 'node_modules/systemjs/dist/system.src.js', - 'node_modules/reflect-metadata/Reflect.js', - 'node_modules/angular2/es6/dev/src/testing/shims_for_IE.js', - { pattern: 'node_modules/angular2/**/*.js', included: false, watched: false }, - { pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false }, - { pattern: 'dist/**/*.js', included: false, watched: true }, - { pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false }, // PhantomJS2 (and possibly others) might require it - { pattern: 'node_modules/ng2-alfresco-core/services.js', included: false, watched: false }, // source files - { pattern: 'node_modules/ng2-alfresco-core/services/*.js', included: false, watched: false }, // source files + // paths loaded by Karma + {pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true}, + {pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true}, + {pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: true}, + {pattern: 'node_modules/angular2/bundles/angular2.dev.js', included: true, watched: true}, + {pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true}, + {pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true}, + {pattern: 'node_modules/alfresco-core-rest-api/bundle.js', included: true, watched: false}, - // suppress annoying 404 warnings for resources, images, etc. - //{ pattern: 'dist/src/assets/**/*', watched: false, included: false, served: true }, + {pattern: 'karma-test-shim.js', included: true, watched: true}, - 'test-main.js' + // 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} ], - // must go along with above, suppress annoying 404 warnings. + // proxied base paths proxies: { - '/assets/': '/base/dist/dev/assets/' + // required for component assets fetched by Angular's compiler + '/src/': '/base/src/' }, - // list of files to exclude - exclude: [ - 'node_modules/angular2/**/*spec.js' + port: 9876, + + logLevel: config.LOG_DEBUG, + + colors: true, + + autoWatch: true, + + browsers: ['Chrome'], + + // Karma plugins loaded + plugins: [ + 'karma-jasmine', + 'karma-coverage', + 'karma-chrome-launcher' ], + // Coverage reporter generates the coverage + reporters: ['progress', 'dots', 'coverage'], - // preprocess matching files before serving them to the browser - // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + // Source files that you wanna generate coverage for. + // Do not include tests or libraries (these files will be instrumented by Istanbul) preprocessors: { 'dist/**/!(*spec).js': ['coverage'] }, - // test results reporter to use - // possible values: 'dots', 'progress' - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['mocha', 'coverage'], - - - // 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: true, - - - // start these browsers - // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: [ - 'PhantomJS', - 'Chrome' - ], - - - customLaunchers: { - Chrome_travis_ci: { - base: 'Chrome', - flags: ['--no-sandbox'] - } - }, - coverageReporter: { - dir: 'coverage/', - reporters: [ - { type: 'text-summary' }, - { type: 'json', subdir: '.', file: 'coverage-final.json' }, - { type: 'html' } + reporters:[ + {type: 'json', subdir: '.', file: 'coverage-final.json'} ] }, - // Continuous Integration mode - // if true, Karma captures browsers, runs the tests and exits - singleRun: false, - - // Passing command line arguments to tests - client: { - files: argv.files - } - }); - - if (process.env.APPVEYOR) { - config.browsers = ['IE']; - config.singleRun = true; - config.browserNoActivityTimeout = 90000; // Note: default value (10000) is not enough - } - - if (process.env.TRAVIS || process.env.CIRCLECI) { - config.browsers = ['Chrome_travis_ci']; - config.singleRun = true; - } + singleRun: true + }) }; diff --git a/ng2-components/ng2-alfresco-documentlist/package.json b/ng2-components/ng2-alfresco-documentlist/package.json index 2ff6653fe2..0269b3128c 100644 --- a/ng2-components/ng2-alfresco-documentlist/package.json +++ b/ng2-components/ng2-alfresco-documentlist/package.json @@ -1,91 +1,89 @@ { - "name": "ng2-alfresco-documentlist", - "description": "Alfresco Angular2 Document List Component", - "version": "0.1.0", - "author": "Alfresco Software, Ltd.", - "scripts": { - "build": "npm run tslint-test && npm run tslint-src && npm run tslint-root && typings install && rm -rf dist && tsc && license-check", - "tslint-test": "tslint -c tslint.json test/**/*.ts", - "tslint-src": "tslint -c tslint.json src/**/*.ts", - "tslint-root": "tslint -c tslint.json *.ts", - "licensecheck": "license-check", - "tsc": "tsc", - "tsc:w": "tsc -w", - "typings": "typings", - "test": "karma start karma.conf.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/Alfresco/dev-platform-webcomponents.git" - }, - "bugs": { - "url": "https://github.com/Alfresco/dev-platform-webcomponents/issues" - }, - "license": "Apache-2.0", - "contributors": [ - { - "name": "Denys Vuika", - "email": "denis.vuyka@gmail.com" + "name": "ng2-alfresco-documentlist", + "description": "Alfresco Angular2 Document List Component", + "version": "0.1.0", + "author": "Alfresco Software, Ltd.", + "scripts": { + "postinstall": "npm run typings", + "typings": "typings install", + "start": "npm run test && http-server -c-1 -o -p 8875 .", + "build": "npm run tslint-test && npm run tslint-src && npm run tslint-root && typings install && rm -rf dist && tsc && license-check", + "tslint-test": "tslint -c tslint.json test/**/*.ts", + "tslint-src": "tslint -c tslint.json src/**/*.ts", + "tslint-root": "tslint -c tslint.json *.ts", + "licensecheck": "license-check", + "tsc": "tsc", + "pretest": "npm run build", + "test": "karma start karma.conf.js", + "posttest": "node_modules/.bin/remap-istanbul -i coverage/coverage-final.json -o coverage -t html", + "coverage": "http-server -c-1 -o -p 9875 ./coverage" }, - { - "name": "Mario Romano", - "email": "mario.romano83@gmail.com" - } - ], - "keywords": [ - "ng2", - "angular", - "angular2", - "alfresco" - ], - "dependencies": { - "angular2": "2.0.0-beta.15", - "systemjs": "0.19.26", - "es6-shim": "^0.35.0", - "reflect-metadata": "0.1.2", - "rxjs": "5.0.0-beta.2", - "zone.js": "^0.6.12", - "es6-module-loader": "^0.17.8" - }, - "peerDependencies": { - "angular2": "2.0.0-beta.15" - }, - "devDependencies": { - "concurrently": "^2.0.0", - "coveralls": "^2.11.9", - "jasmine-core": "2.4.1", - "jasmine-spec-reporter": "^2.4.0", - "karma": "~0.13.22", - "karma-chrome-launcher": "~1.0.1", - "karma-coverage": "^1.0.0", - "karma-ie-launcher": "^1.0.0", - "karma-jasmine": "~1.0.2", - "karma-mocha-reporter": "^2.0.3", - "karma-phantomjs-launcher": "^1.0.0", - "license-check": "^1.0.4", - "live-server": "^0.9.2", - "phantomjs-prebuilt": "^2.1.7", - "remap-istanbul": "^0.6.3", - "traceur": "^0.0.91", - "tslint": "^3.8.1", - "typescript": "^1.8.10", - "typings": "^0.7.12", - "xo": "^0.14.0", - "yargs": "^4.7.0" - }, - "license-check-config": { - "src": [ - "**/*.js", - "**/*.ts", - "!/**/coverage/**/*", - "!/**/demo/**/*", - "!/**/node_modules/**/*", - "!/**/typings/**/*", - "!*.js" + "repository": { + "type": "git", + "url": "https://github.com/Alfresco/dev-platform-webcomponents.git" + }, + "bugs": { + "url": "https://github.com/Alfresco/dev-platform-webcomponents/issues" + }, + "license": "Apache-2.0", + "contributors": [ + { + "name": "Denys Vuika", + "email": "denis.vuyka@gmail.com" + }, + { + "name": "Mario Romano", + "email": "mario.romano83@gmail.com" + } ], - "path": "assets/license_header.txt", - "blocking": false, - "logInfo": false, - "logError": true - } + "keywords": [ + "ng2", + "angular", + "angular2", + "alfresco" + ], + "dependencies": { + "angular2": "2.0.0-beta.15", + "systemjs": "0.19.26", + "es6-shim": "^0.35.0", + "reflect-metadata": "0.1.2", + "rxjs": "5.0.0-beta.2", + "zone.js": "^0.6.12", + "es6-module-loader": "^0.17.8" + }, + "peerDependencies": { + "angular2": "2.0.0-beta.15" + }, + "devDependencies": { + "coveralls": "^2.11.9", + "jasmine-core": "2.4.1", + "karma": "~0.13.22", + "karma-chrome-launcher": "~1.0.1", + "karma-coverage": "^1.0.0", + "karma-jasmine": "~1.0.2", + "license-check": "^1.0.4", + "remap-istanbul": "^0.6.3", + "traceur": "^0.0.91", + "tslint": "^3.8.1", + "typescript": "^1.8.10", + "typings": "^0.7.12", + "xo": "^0.14.0", + "yargs": "^4.7.0", + "http-server": "0.8.5" + }, + "license-check-config": { + "src": [ + "**/*.js", + "**/*.ts", + "!/**/coverage/**/*", + "!/**/demo/**/*", + "!/**/node_modules/**/*", + "!/**/typings/**/*", + "!*.js" + ], + "path": "assets/license_header.txt", + "blocking": false, + "logInfo": false, + "logError": true + } } diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts index 6b343e5cfb..3baeb4842b 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts @@ -22,12 +22,14 @@ import { beforeEach } from 'angular2/testing'; import {EventEmitter} from 'angular2/core'; -import {DocumentList} from '../../src/components/document-list'; + +import {DocumentList} from './document-list'; import {AlfrescoServiceMock} from '../assets/alfresco.service.mock'; -import {ContentActionList} from '../../src/components/content-action-list'; -import {ContentAction} from '../../src/components/content-action'; -import {DocumentActionsService} from '../../src/services/document-actions.service'; -import {FolderActionsService} from '../../src/services/folder-actions.service'; + +import {ContentActionList} from './content-action-list'; +import {ContentAction} from './content-action'; +import {DocumentActionsService} from '../services/document-actions.service'; +import {FolderActionsService} from '../services/folder-actions.service'; describe('ContentAction', () => { @@ -175,5 +177,4 @@ describe('ContentAction', () => { let model = documentList.actions[0]; model.handler(''); }); - }); diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts index dee4e4fe38..9eb5632dd2 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts @@ -21,10 +21,11 @@ import { expect, beforeEach } from 'angular2/testing'; -import {DocumentList} from '../../src/components/document-list'; + +import {DocumentList} from './document-list'; import {AlfrescoServiceMock} from '../assets/alfresco.service.mock'; -import {ContentColumnList} from '../../src/components/content-column-list'; -import {ContentColumnModel} from '../../src/models/content-column.model'; +import {ContentColumnList} from './content-column-list'; +import {ContentColumnModel} from '../models/content-column.model'; describe('ContentColumnList', () => { diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts index 7289c70337..9cc5d46aca 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts @@ -21,10 +21,11 @@ import { expect, beforeEach } from 'angular2/testing'; -import {DocumentList} from '../../src/components/document-list'; -import {ContentColumn} from '../../src/components/content-column'; + +import {DocumentList} from './document-list'; +import {ContentColumn} from './content-column'; import {AlfrescoServiceMock} from '../assets/alfresco.service.mock'; -import {ContentColumnList} from '../../src/components/content-column-list'; +import {ContentColumnList} from './content-column-list'; describe('ContentColumn', () => { diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts index 5ab9911d43..f7e2417d4c 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts @@ -21,11 +21,12 @@ import { expect, beforeEach } from 'angular2/testing'; -import { DocumentList } from '../../src/components/document-list'; -import { ContentColumnModel } from '../../src/models/content-column.model'; + +import { DocumentList } from './document-list'; +import { ContentColumnModel } from '../models/content-column.model'; import { AlfrescoServiceMock } from '../assets/alfresco.service.mock'; -import { MinimalNodeEntity } from '../../src/models/document-library.model'; -import { ContentActionModel } from '../../src/models/content-action.model'; +import { MinimalNodeEntity, MinimalNodeEntryEntity } from '../models/document-library.model'; +import { ContentActionModel } from '../models/content-action.model'; describe('DocumentList', () => { @@ -256,6 +257,7 @@ describe('DocumentList', () => { let path = '/'; let node = new MinimalNodeEntity(); + node.entry = new MinimalNodeEntryEntity(); node.entry.isFolder = true; node.entry.name = ''; @@ -285,6 +287,7 @@ describe('DocumentList', () => { spyOn(documentList, 'displayFolderContent').and.stub(); let node = new MinimalNodeEntity(); + node.entry = new MinimalNodeEntryEntity(); node.entry.isFolder = false; documentList.onItemClick(node); @@ -296,6 +299,7 @@ describe('DocumentList', () => { spyOn(documentList, 'displayFolderContent').and.stub(); let node = new MinimalNodeEntity(); + node.entry = new MinimalNodeEntryEntity(); node.entry.isFolder = true; node.entry.name = ''; diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts index f1f71e7f52..3bb1dcfcff 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts @@ -24,6 +24,7 @@ import { AfterContentInit, AfterViewChecked } from 'angular2/core'; + import { AlfrescoService } from './../services/alfresco.service'; import { MinimalNodeEntity, NodePaging } from './../models/document-library.model'; import { ContentActionModel } from './../models/content-action.model'; @@ -60,7 +61,7 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit name: 'Document Library', path: 'Sites/swsdp/documentLibrary' }; - currentFolderPath: string = 'swsdp/documentLibrary'; + currentFolderPath: string = 'Sites/swsdp/documentLibrary'; folder: NodePaging; errorMessage; @@ -152,7 +153,7 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit }); if (this.navigate && item) { - if (item.entry.isFolder) { + if (item.entry && item.entry.isFolder) { let path = this.getNodePath(item); this.folderClick.emit({ diff --git a/ng2-components/ng2-alfresco-documentlist/src/services/document-actions.service.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/services/document-actions.service.spec.ts index 0f7809fb05..b5e0f4993e 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/services/document-actions.service.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/services/document-actions.service.spec.ts @@ -21,8 +21,8 @@ import { expect, beforeEach } from 'angular2/testing'; -import {ContentActionHandler} from '../../src/models/content-action.model'; -import {DocumentActionsService} from '../../src/services/document-actions.service'; +import {ContentActionHandler} from '../models/content-action.model'; +import {DocumentActionsService} from './document-actions.service'; import {AlfrescoServiceMock} from '../assets/alfresco.service.mock'; describe('DocumentActionsService', () => { diff --git a/ng2-components/ng2-alfresco-documentlist/src/services/folder-actions.service.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/services/folder-actions.service.spec.ts index 3c01c50302..f500e3a4b8 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/services/folder-actions.service.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/services/folder-actions.service.spec.ts @@ -21,8 +21,8 @@ import { expect, beforeEach } from 'angular2/testing'; -import {FolderActionsService} from '../../src/services/folder-actions.service'; -import {ContentActionHandler} from '../../src/models/content-action.model'; +import {FolderActionsService} from './folder-actions.service'; +import {ContentActionHandler} from '../models/content-action.model'; describe('FolderActionsService', () => { diff --git a/ng2-components/ng2-alfresco-documentlist/test-main.js b/ng2-components/ng2-alfresco-documentlist/test-main.js deleted file mode 100644 index 20327db28f..0000000000 --- a/ng2-components/ng2-alfresco-documentlist/test-main.js +++ /dev/null @@ -1,79 +0,0 @@ -if (!Object.hasOwnProperty('name')) { - Object.defineProperty(Function.prototype, 'name', { - get: function() { - var matches = this.toString().match(/^\s*function\s*(\S*)\s*\(/); - var name = matches && matches.length > 1 ? matches[1] : ""; - Object.defineProperty(this, 'name', {value: name}); - return name; - } - }); -} - -// Turn on full stack traces in errors to help debugging -Error.stackTraceLimit = Infinity; - -jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; - -// Cancel Karma's synchronous start, -// we will call `__karma__.start()` later, once all the specs are loaded. -__karma__.loaded = function() {}; - -System.config({ - baseURL: '/base/', - defaultJSExtensions: true, - paths: { - 'angular2/*': 'node_modules/angular2/*.js', - 'rxjs/*': 'node_modules/rxjs/*.js', - 'ng2-alfresco-core/*': 'node_modules/ng2-alfresco-core/services.js', - 'ng2-alfresco-core/services/*': 'node_modules/ng2-alfresco-core/services/*' - } -}); - -Promise.all([ - System.import('angular2/src/platform/browser/browser_adapter'), - System.import('angular2/platform/testing/browser'), - System.import('angular2/testing') -]).then(function (modules) { - var browser_adapter = modules[0]; - var providers = modules[1]; - var testing = modules[2]; - testing.setBaseTestProviders(providers.TEST_BROWSER_PLATFORM_PROVIDERS, - providers.TEST_BROWSER_APPLICATION_PROVIDERS); - - browser_adapter.BrowserDomAdapter.makeCurrent(); -}).then(function() { - return Promise.all( - Object.keys(window.__karma__.files) // All files served by Karma. - .filter(onlySpecFiles) - .map(file2moduleName) - .map(function(path) { - return System.import(path).then(function(module) { - if (module.hasOwnProperty('main')) { - module.main(); - } else { - throw new Error('Module ' + path + ' does not implement main() method.'); - } - }); - })); - }) - .then(function() { - __karma__.start(); - }, function(error) { - // console.error(error.stack || error); - __karma__.start(); - }); - -function onlySpecFiles(path) { - // check for individual files, if not given, always matches to all - var patternMatched = __karma__.config.files ? - path.match(new RegExp(__karma__.config.files)) : true; - - return patternMatched && /[\.|_]spec\.js$/.test(path); -} - -// Normalize paths to module names. -function file2moduleName(filePath) { - return filePath.replace(/\\/g, '/') - .replace(/^\/base\//, '') - .replace(/\.js$/, ''); -} diff --git a/ng2-components/ng2-alfresco-documentlist/tsconfig.json b/ng2-components/ng2-alfresco-documentlist/tsconfig.json index 24c8c6b7ce..49efd9dce5 100644 --- a/ng2-components/ng2-alfresco-documentlist/tsconfig.json +++ b/ng2-components/ng2-alfresco-documentlist/tsconfig.json @@ -1,27 +1,20 @@ { "compilerOptions": { "target": "es5", - "module": "commonjs", - "declaration": true, - "removeComments": true, - "noLib": false, + "module": "system", + "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "sourceMap": true, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "noImplicitAny": false, - "noImplicitReturns": false, - "noImplicitUseStrict": false, - "noFallthroughCasesInSwitch": true, + "removeComments": true, + "declaration": true, "outDir": "dist" }, "exclude": [ + "backup", + "node_modules", - "dist", - "typings/browser.d.ts", - "typings/browser", - "demo" - ], - "compileOnSave": false + "typings/main", + "typings/main.d.ts" + ] }