Skip to content

Commit

Permalink
perf: use single karma configuration for unit and integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amoncaldas committed Oct 22, 2021
1 parent 32781e0 commit 5a992c6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"release": "standard-version",
"start": "npm run dev",
"test:unit": "cross-env BABEL_ENV=test karma start tests/unit/karma.conf.js",
"test:unit-debug": "cross-env BABEL_ENV=test karma start tests/unit/karma.debug.conf.js",
"test:e2e": "node tests/e2e/runner.js",
"test": "npm run test:integration && npm run test:unit",
"test:integration": "cross-env BABEL_ENV=test karma start tests/integration/karma.conf.js",
"test:integration-debug": "cross-env BABEL_ENV=test karma start tests/integration/karma.debug.conf.js"
"test": "cross-env BABEL_ENV=test karma start tests/karma.conf.js",
"test:debug": "cross-env BABEL_ENV=test karma start tests/karma.debug.conf.js"
},
"dependencies": {
"@babel/eslint-parser": "^7.11.3",
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions tests/integration/karma.conf.js → tests/karma.conf.js
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line no-undef
const testWebpackConfig = require('../../build/webpack.test.conf')
const testWebpackConfig = require('../build/webpack.test.conf')

// eslint-disable-next-line no-undef
module.exports = function (config) {
Expand All @@ -10,7 +10,8 @@ module.exports = function (config) {
exclude: [],
//files/patterns to load in the browser
files: [
{ pattern: 'specs/*.js', watched: true, served: true, included: true }
{ pattern: 'unit/specs/*[sS]pec.js', watched: true, served: true, included: true },
{ pattern: 'integration/specs/*[sS]pec.js', watched: true, served: true, included: true }
/*parameters:
watched: if autoWatch is true all files that have set watched to true will be watched for changes
served: should the files be served by Karma's webserver?
Expand Down Expand Up @@ -97,7 +98,8 @@ module.exports = function (config) {
webpack: testWebpackConfig,
preprocessors: {
//add webpack as preprocessor to support require() in test-suits .js files
'./specs/*.js': ['webpack'],
'integration/specs/*[sS]pec.js': ['webpack'],
'unit/specs/*[sS]pec.js': ['webpack'],
'**/src/app/*.js': ['coverage']
},
webpackMiddleware: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// eslint-disable-next-line no-undef
const testWebpackConfig = require('../../build/webpack.test.conf')

process.env.ORSKEY =
'5b3ce3597851110001cf62484c2b303725d843b5b765b5e83e8e3c30'
const testWebpackConfig = require('../build/webpack.test.conf')

// eslint-disable-next-line no-undef
module.exports = function (config) {
Expand All @@ -13,7 +10,8 @@ module.exports = function (config) {
exclude: [],
//files/patterns to load in the browser
files: [
{ pattern: 'specs/*.js', watched: true, served: true, included: true }
{ pattern: 'unit/specs/*[sS]pec.js', watched: true, served: true, included: true },
{ pattern: 'integration/specs/*[sS]pec.js', watched: true, served: true, included: true }
/*parameters:
watched: if autoWatch is true all files that have set watched to true will be watched for changes
served: should the files be served by Karma's webserver?
Expand Down Expand Up @@ -100,7 +98,8 @@ module.exports = function (config) {
webpack: testWebpackConfig,
preprocessors: {
//add webpack as preprocessor to support require() in test-suits .js files
'./specs/*.js': ['webpack'],
'integration/specs/*[sS]pec.js': ['webpack'],
'unit/specs/*[sS]pec.js': ['webpack'],
'**/src/app/*.js': ['coverage']
},
webpackMiddleware: {
Expand Down

0 comments on commit 5a992c6

Please sign in to comment.