Skip to content

Commit

Permalink
Switch to ES6 modules, change test behavior
Browse files Browse the repository at this point in the history
Now project is using ES6 modules and displays coverage reports for
browser tests (made via karma), while nodejs tests only keygens.
  • Loading branch information
bacher09 committed Jun 6, 2020
1 parent 4596541 commit e8bf6dc
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 782 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ script:
- npm run browser-test
- npm run lint
after_sucess:
- npm run send-coverage
- cat coverage/lcov.info | ./node_modules/.bin/coveralls
git:
depth: 1
submodules: false
Expand Down
5 changes: 3 additions & 2 deletions jasmine.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"displayStacktrace": "all"
}
}],
"spec_dir": "src",
"spec_dir": "src/keygen/",
"spec_files": ["**/*.spec.ts"],
"helpers": [
"./node_modules/babel-register/lib/node.js"
"../node_modules/esm",
"../node_modules/ts-node/register/index.js"
]
}
26 changes: 21 additions & 5 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require("path");

module.exports = function(config) {

var customLaunchers = {
Expand Down Expand Up @@ -33,7 +35,7 @@ module.exports = function(config) {
{pattern: './ci/spec-bundle.js', watched: false}
],
preprocessors: {
'./ci/spec-bundle.js': ['webpack', 'sourcemap'],
'./ci/spec-bundle.js': ['webpack'],
},
webpackMiddleware: {
scripts: 'errors-only'
Expand All @@ -42,14 +44,22 @@ module.exports = function(config) {
devtool: "inline-source-map",
mode: "development",
resolve: {
extensions: ['.ts', '.js'],
extensions: ['.ts', '.js', '.mjs'],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [{loader: 'ts-loader', options: {transpileOnly: true}}]
use: [
"@jsdevtools/coverage-istanbul-loader",
{loader: 'ts-loader', options: {transpileOnly: true}}
]
},
{
test: /\.m?js$/,
exclude: /node_modules/,
use: [{loader: 'babel-loader', options: {presets: ['@babel/preset-env']}}]
}
]
},
Expand All @@ -63,7 +73,13 @@ module.exports = function(config) {
recordVideo: false,
recordScreenshots: false
},
reporters: ["progress", "saucelabs"],
reporters: ["progress", "saucelabs", "coverage-istanbul"],
coverageIstanbulReporter: {
reports: ['text', 'text-summary', "lcovonly"],
dir: path.join(__dirname, "coverage"),
combineBrowserReports: true,
fixWebpackSourcePaths: true,
},
browsers: ["ChromeHeadless", "FirefoxHeadless"],
customLaunchers: customLaunchers,
singleRun: true,
Expand All @@ -74,7 +90,7 @@ module.exports = function(config) {
'karma-firefox-launcher',
'karma-sauce-launcher',
'karma-webpack',
'karma-sourcemap-loader'
'karma-coverage-istanbul-reporter'
]
};

Expand Down
Loading

0 comments on commit e8bf6dc

Please sign in to comment.