diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..5e2ee1fa7e --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,33 @@ +# Node.js +# Build a general Node.js project with npm. +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript + +trigger: + branches: + include: + - master + paths: + exclude: + - docs/* + +pool: + # todo: we dgaf what specific version of Linux is installed, is there any way to wildcard the version? + vmImage: 'Ubuntu-16.04' + +steps: +- script: | + npm install + displayName: 'npm install' +- script: | + npm run bootstrap-packages + displayName: 'bootstrapping packages' +- script: | + npm run build-packages + displayName: 'building packages' +- script: | + npm run test-packages + displayName: 'running tests' + env: { + testEnv: 'ci' + } diff --git a/packages/sitecore-jss-angular/karma.conf.js b/packages/sitecore-jss-angular/karma.conf.js index 6a087996ac..c8825171b0 100644 --- a/packages/sitecore-jss-angular/karma.conf.js +++ b/packages/sitecore-jss-angular/karma.conf.js @@ -1,14 +1,12 @@ /* eslint-disable func-names */ module.exports = function(config) { - config.set({ + const karmaConfig = { // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', - // frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine', 'karma-typescript'], - // list of files / patterns to load in the browser files: [ { pattern: 'node_modules/reflect-metadata/Reflect.js', watched: false }, @@ -21,21 +19,14 @@ module.exports = function(config) { { pattern: 'node_modules/zone.js/dist/fake-async-test.js', watched: false }, { pattern: './src/**/*.ts' }, ], - // list of files to exclude exclude: [], - // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: { - '**/*.ts': ['karma-typescript'], - }, - + preprocessors: { '**/*.ts': ['karma-typescript'] }, karmaTypescriptConfig: { include: ['./src/**/*.ts'], - compilerOptions: { - lib: ['es2017', 'dom'], - }, + compilerOptions: { lib: ['es2017', 'dom'] }, reports: { 'json-summary': { directory: './coverage', @@ -45,35 +36,34 @@ module.exports = function(config) { text: '', }, }, - // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['progress', 'karma-typescript'], - // 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: ['Chrome'], - // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: true, - // Concurrency level // how many browser should be started simultaneous concurrency: Infinity, - }); + }; + + if (process.env.testEnv && process.env.testEnv === 'ci') { + karmaConfig.browsers = ['ChromeHeadless']; + karmaConfig.singleRun = true; + } + + config.set(karmaConfig); };