Skip to content

Commit

Permalink
add karma test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasMadsen committed Jun 26, 2019
1 parent 1f47abe commit e6d4a5b
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 72 deletions.
78 changes: 78 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@

module.exports = function(config) {
config.set({

// 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'],

// Typescript configuration, not that coverage instrumentation must be on,
// for the source mapping to work correctly.
karmaTypescriptConfig: {
tsconfig: 'tsconfig.json',
coverageOptions: process.env.KARMA_COVERAGE ? { exclude: /_test\.ts$/ } : {},
reports: process.env.KARMA_COVERAGE ? {html: 'coverage', 'text-summary': ''} : {},
exclude: ["node_modules"],
bundlerOptions: {sourceMap: true}
},

// list of files / patterns to load in the browser
files: [
{pattern: 'src/!(builder)/**/*.ts'},
{pattern: 'src/*.ts'}
],


// list of files / patterns to exclude
exclude: [],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/!(builder)/**/*.ts': ['karma-typescript'],
'src/*.ts': ['karma-typescript']
},


// 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: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,32 @@
"name": "tfjs-cephes",
"version": "1.0.0",
"description": "",
"main": "inf-test.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "watchify inf-test.js -p [ tsify --noImplicitAny ] -o bundle.js"
"build": "tsc",
"test": "karma start",
"lint": "tslint -p . -t verbose"
},
"author": "",
"license": "ISC",
"dependencies": {
"@tensorflow/tfjs-core": "^1.2.0"
"peerDependencies": {
"@tensorflow/tfjs-core": "1.2.1"
},
"devDependencies": {
"@tensorflow/tfjs-core": "^1.2.0",
"@types/jasmine": "^3.3.13",
"@types/webgl-ext": "0.0.30",
"@types/webgl2": "0.0.4",
"@types/node": "~9.6.0",
"jasmine": "~3.1.0",
"jasmine-core": "~3.1.0",
"karma": "~2.0.2",
"karma-browserstack-launcher": "~1.3.0",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-jasmine": "~1.1.0",
"karma-typescript": "~3.0.12",
"node-c-parser": "^1.0.11",
"karma-typescript": "~4.0.0",
"tslint": "~5.11.0",
"tslint-no-circular-imports": "~0.5.0",
"typescript": "^3.3.1"
"typescript": "3.3.3333"
}
}
5 changes: 5 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
Expand All @@ -22,5 +24,8 @@
},
"include": [
"src/"
],
"exclude": [
"node_moduels"
]
}
123 changes: 61 additions & 62 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -1,64 +1,63 @@
{
"extends": ["tslint-no-circular-imports"],
"rules": {
"array-type": [true, "array-simple"],
"arrow-return-shorthand": true,
"ban": [true,
["fit"],
["fdescribe"],
["xit"],
["xdescribe"],
["fitAsync"],
["xitAsync"],
["fitFakeAsync"],
["xitFakeAsync"]
],
"ban-types": [true,
["Object", "Use {} instead."],
["String", "Use 'string' instead."],
["Number", "Use 'number' instead."],
["Boolean", "Use 'boolean' instead."]
],
"class-name": true,
"curly": true,
"interface-name": [true, "never-prefix"],
"jsdoc-format": true,
"forin": false,
"label-position": true,
"max-line-length": {
"options": {"limit": 80, "ignore-pattern": "^import |^export "}
},
"new-parens": true,
"no-angle-bracket-type-assertion": true,
"no-any": true,
"no-construct": true,
"no-consecutive-blank-lines": true,
"no-debugger": true,
"no-default-export": true,
"no-inferrable-types": true,
"no-namespace": [true, "allow-declarations"],
"no-reference": true,
"no-require-imports": true,
"no-string-throw": true,
"no-unused-expression": true,
"no-var-keyword": true,
"object-literal-shorthand": true,
"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
"prefer-const": true,
"quotemark": [true, "single"],
"radix": true,
"restrict-plus-operands": true,
"semicolon": [true, "always", "ignore-bound-class-methods"],
"switch-default": true,
"triple-equals": [true, "allow-null-check"],
"use-isnan": true,
"variable-name": [
true,
"check-format",
"ban-keywords",
"allow-leading-underscore",
"allow-trailing-underscore"
]
}
"rules": {
"array-type": [true, "array-simple"],
"arrow-return-shorthand": true,
"ban": [true,
["fit"],
["fdescribe"],
["xit"],
["xdescribe"],
["fitAsync"],
["xitAsync"],
["fitFakeAsync"],
["xitFakeAsync"]
],
"ban-types": [true,
["Object", "Use {} instead."],
["String", "Use 'string' instead."],
["Number", "Use 'number' instead."],
["Boolean", "Use 'boolean' instead."]
],
"class-name": true,
"curly": true,
"interface-name": [true, "never-prefix"],
"jsdoc-format": true,
"forin": false,
"label-position": true,
"max-line-length": {
"options": {"limit": 80, "ignore-pattern": "^import |^export |https?://"}
},
"new-parens": true,
"no-angle-bracket-type-assertion": true,
"no-any": true,
"no-construct": true,
"no-consecutive-blank-lines": true,
"no-debugger": true,
"no-default-export": true,
"no-inferrable-types": true,
"no-namespace": [true, "allow-declarations"],
"no-reference": true,
"no-require-imports": true,
"no-string-throw": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-var-keyword": true,
"object-literal-shorthand": true,
"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
"prefer-const": true,
"quotemark": [true, "single"],
"radix": true,
"restrict-plus-operands": true,
"semicolon": [true, "always", "ignore-bound-class-methods"],
"switch-default": true,
"triple-equals": [true, "allow-null-check"],
"use-isnan": true,
"variable-name": [
true,
"check-format",
"ban-keywords",
"allow-leading-underscore",
"allow-trailing-underscore"
]
}
}

0 comments on commit e6d4a5b

Please sign in to comment.