javascript - In 'Visual Studio 2015 Test Explorer', getting Message: Uncaught SyntaxError: Unexpected token import -
i using karma, jasmine in visual studio 2015 update 2 run unit test application.
i have used 'karma test adapter' so.
my karma.conf.js is:
module.exports = function (config) { config.set({ // base path used resolve patterns (eg. files, exclude) basepath: '', // frameworks use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'], // list of files / patterns load in browser files: [ { pattern: 'src/test/app.component.spec.js', included: true }, { pattern: 'src/**/*spec.ts', included: false }, { pattern: 'src/**/**/*spec.ts', included: false }, { pattern: 'src/**/**/**/*spec.ts', included: false }, { pattern: 'node_modules/zone.js/dist/zone.js', included: true, watched: false }, { pattern: 'node_modules/zone.js/dist/long-stack-trace-zone.js', included: true, watched: false }, { pattern: 'node_modules/zone.js/dist/async-test.js', included: true, watched: false }, { pattern: 'node_modules/zone.js/dist/jasmine-patch.js', included: true, watched: false }, { pattern: 'node_modules/reflect-metadata/reflect.js', included: true, watched: false }, { pattern: 'node_modules/@angular/**/*.js', included: false, watched: false }, { pattern: 'src/**/*.spec.ts', included: true }, { pattern: 'node_modules/systemjs/dist/system.src.js', included: true }, { pattern: 'node_modules/core-js/client/shim.min.js', included:true } ], // list of files exclude exclude: [ ], // preprocess matching files before serving them browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { }, // test results reporter use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['progress'], // web server port port: 9876, // enable / disable colors in output (reporters , 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 , executing tests whenever file changes autowatch: true, // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['chrome'], // continuous integration mode // if true, karma captures browsers, runs tests , exits singlerun: false, // concurrency level // how many browser should started simultaneous concurrency: infinity }) }
my test file is:
import {appcomponent} './app.component'; describe('test search in insite', () => { var cc = new appcomponent(); it('data enquiry should return something', () => {expect(cc.search()).tobe("helloo"); }); });
my package.json is:
{ "name": "angular2-webpack", "version": "1.0.0", "description": "angular 2", "main": "index.js", "scripts": { "dev": "webpack-dev-server --history-api-fallback --content-base ./src --open", "postinstall": "rm -rf typings && typings install && npm run webdriver-update", "test": "karma start karma.conf.js", "webdriver-update": "webdriver-manager update", "typings": "typings" }, "author": "", "license": "see license in license", "dependencies": { "@angular/common": "^2.0.0-rc.1", "@angular/compiler": "^2.0.0-rc.1", "@angular/core": "^2.0.0-rc.1", "@angular/http": "^2.0.0-rc.1", "@angular/platform-browser": "^2.0.0-rc.1", "@angular/platform-browser-dynamic": "^2.0.0-rc.1", "@angular/router": "3.0.0-alpha.6", "es6-shim": "^0.35.0", "reflect-metadata": "^0.1.2", "rxjs": "5.0.0-beta.6", "zone.js": "^0.6.12", "require": "^2.4.20", "requirejs": "^2.2.0" }, "devdependencies": { "babel-core": "^6.3.17", "babel-loader": "^6.2.0", "codelyzer": "^0.0.23", "copy-webpack-plugin": "^3.0.0", "css-loader": "^0.23.0", "file-loader": "^0.8.4", "jasmine": "^2.4.1", "jasmine-core": "^2.4.1", "json-loader": "^0.5.4", "karma": "^0.13.15", "karma-chrome-launcher": "^1.0.0", "karma-jasmine": "^1.0.0", "karma-mocha-reporter": "^2.0.0", "karma-phantomjs-launcher": "^1.0.1", "karma-sourcemap-loader": "^0.3.6", "karma-vs-reporter": "^0.8.0", "protractor": "^3.0.0", "raw-loader": "^0.5.1", "stylus": "^0.54.2", "stylus-loader": "^2.0.0", "ts-loader": "^0.8.0", "tslint": "^3.10.2", "tslint-loader": "^2.1.4", "typescript": "^1.7.3", "typings": "^1.0.0", "webpack": "^2.1.0-beta.13", "webpack-dev-server": "^2.1.0-beta.0" } }
getting error 'message: uncaught syntaxerror: unexpected token import' in test explorer. kindly let me solution.
thanks in advance -saggy
Comments
Post a Comment