Installation de jasmine.js et karma.js pour écriture de tests automatisés.

This commit is contained in:
Fabrice PENHOËT 2021-05-05 10:52:22 +02:00
parent 435a2b7342
commit 59182a179a
4 changed files with 2155 additions and 17 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules/ node_modules/
coverage/

68
karma.conf.js Normal file
View File

@ -0,0 +1,68 @@
// Karma configuration
// Generated on Tue May 04 2021 15:52:29 GMT+0200 (heure dété dEurope centrale)
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"],
// list of files / patterns to load in the browser
files: [ "src/vCarousel.ts", "tests/*.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/*.ts': [ 'karma-typescript' ],
'tests/*.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: ['Firefox'],
// 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
})
}

2090
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
{ {
"name": "vCarousel", "name": "vCarousel",
"version": "0.3.0", "version": "0.3.1",
"description": "Video carousel, a new video appears when the previous one finishes playing.", "description": "Video carousel, a new video appears when the previous one finishes playing.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "karma start",
"build": "webpack", "build": "webpack",
"start": "webpack-dev-server" "start": "webpack-dev-server"
}, },
@ -19,6 +19,13 @@
"author": "Fabrice PENHOËT", "author": "Fabrice PENHOËT",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"devDependencies": { "devDependencies": {
"@types/jasmine": "^3.6.10",
"jasmine": "^3.7.0",
"karma": "^6.3.2",
"karma-firefox-launcher": "^2.1.0",
"karma-jasmine": "^4.0.1",
"karma-phantomjs-launcher": "^1.0.4",
"karma-typescript": "^5.5.1",
"ts-loader": "^8.2.0", "ts-loader": "^8.2.0",
"typescript": "^4.2.4", "typescript": "^4.2.4",
"webpack": "^4.46.0", "webpack": "^4.46.0",