Skip to content

Commit

Permalink
add tests dependencies and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
crabbly committed Sep 23, 2018
1 parent cfc251b commit 94b2862
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 4 deletions.
43 changes: 43 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// const path = require('path')

module.exports = function (config) {
config.set({
frameworks: ['jasmine'],
files: [
'test/**/*.spec.js'
],
exclude: [],
preprocessors: {
'test/**/*.js': ['webpack', 'sourcemap', 'coverage']
},
reporters: ['progress', 'coverage'],
coverageReporter: {
dir: 'coverage/',
type: 'lcov',
subdir: '.',
includeAllSources: true,
fixWebpackSourcePaths: true,
combineBrowserReports: true
},
port: 9876,
colors: true,
logLevel: config.LOG_ERROR,
autoWatch: false,
browsers: ['ChromeHeadless'],
singleRun: true,
concurrency: 1,
webpack: {
mode: 'development'
// TODO: Configure istanbul to interpret how webpack bundles files
// module: {
// rules: [
// {
// test: /\.js$/,
// use: { loader: 'istanbul-instrumenter-loader' },
// include: path.resolve('src/js/index.js')
// }
// ]
// }
}
})
}
24 changes: 20 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@
"types": "./index.d.ts",
"repository": "https://github.com/crabbly/Print.js",
"license": "MIT",
"dependences": {},
"dependencies": {},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"coveralls": "^3.0.2",
"css-loader": "^1.0.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine-core": "^3.2.1",
"karma": "^3.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.2",
"karma-jasmine": "^1.1.2",
"karma-phantomjs-launcher": "^1.0.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^3.0.5",
"mini-css-extract-plugin": "^0.4.1",
"node-sass": "^4.9.3",
"optimize-css-assets-webpack-plugin": "^5.0.0",
Expand All @@ -23,16 +33,22 @@
"webpack-cli": "^3.1.0"
},
"scripts": {
"test": "standard",
"test": "standard && karma start",
"dev": "webpack --mode development --progress --hide-modules --devtool source-map",
"watch": "webpack --mode development --watch --progress --hide-modules",
"production": "webpack --mode production --progress --hide-modules"
"production": "webpack --mode production --progress --hide-modules",
"coverage": "open coverage/lcov-report/index.html",
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
},
"author": "Rodrigo Vieira <rodrigo@crabbly.com>",
"standard": {
"ignore": [
"/dist/print.js"
]
],
"env": {
"browser": true,
"jasmine": true
}
},
"keywords": [
"printjs",
Expand Down
10 changes: 10 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ module.exports = {
}
}
},
// TODO: Configure istanbul to interpret how webpack bundles files
// {
// test: /\.js$/,
// use: {
// loader: 'istanbul-instrumenter-loader',
// options: { esModules: true }
// },
// enforce: 'post',
// exclude: /node_modules|\.spec\.js$/
// },
{
test: /\.scss$/,
use: [
Expand Down

0 comments on commit 94b2862

Please sign in to comment.