-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #3 some testing using Karma and Jasmine
- Loading branch information
1 parent
92d6f37
commit 1037bf0
Showing
6 changed files
with
128 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ jobs: | |
- name: test | ||
run: | | ||
npm run test | ||
xvfb-run npm run test | ||
#npm run coverage | ||
- name: lint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// Karma configuration | ||
// Generated on Tue May 03 2022 15:45:30 GMT+0100 (British Summer Time) | ||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const sourcePath = path.join(__dirname, './src'); | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
|
||
plugins: [ | ||
require('karma-webpack'), | ||
require('karma-jasmine'), | ||
require('karma-chrome-launcher'), | ||
], | ||
|
||
|
||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: '', | ||
|
||
|
||
// frameworks to use | ||
// available frameworks: https://www.npmjs.com/search?q=keywords:karma-adapter | ||
frameworks: ['jasmine', 'webpack'], | ||
|
||
|
||
// list of files / patterns to load in the browser | ||
files: [ | ||
'src/**/*.js', | ||
'src/test/**/*Spec.js' | ||
], | ||
|
||
|
||
// list of files / patterns to exclude | ||
exclude: [ | ||
], | ||
|
||
|
||
// preprocess matching files before serving them to the browser | ||
// available preprocessors: https://www.npmjs.com/search?q=keywords:karma-preprocessor | ||
preprocessors: { | ||
'src/**/*.js': ['webpack'], | ||
'src/**/*Spec.js': ['webpack'], | ||
}, | ||
|
||
webpack: { | ||
mode: 'development', | ||
resolve: { | ||
modules: [path.resolve(__dirname, 'node_modules'), sourcePath], | ||
alias: { | ||
'luminance_study': __dirname, | ||
stream: 'stream-browserify', | ||
buffer: 'buffer', | ||
}, | ||
fallback: { | ||
path: false, | ||
fs: false, | ||
}, | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
__BASE_PATH__: "'/base'", | ||
}), | ||
new webpack.ProvidePlugin({ process: ['process/browser'] }), | ||
], | ||
}, | ||
|
||
|
||
// test results reporter to use | ||
// possible values: 'dots', 'progress' | ||
// available reporters: https://www.npmjs.com/search?q=keywords:karma-reporter | ||
reporters: ['progress'], | ||
|
||
|
||
// 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://www.npmjs.com/search?q=keywords:karma-launcher | ||
browsers: ['Chrome'], | ||
|
||
|
||
// Continuous Integration mode | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: false, | ||
|
||
// Concurrency level | ||
// how many browser instances should be started simultaneously | ||
concurrency: Infinity | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
|
||
import { assert } from 'chai'; | ||
//import { assert } from 'chai'; | ||
import { setupLights } from '../lights.js'; | ||
//const assert = require('assert'); | ||
|
||
describe('Simple Math Test', () => { | ||
it('should return 2', () => { | ||
assert.equal(1 + 1, 2); | ||
expect(1 + 1).toBe(2); | ||
}); | ||
it('should return 9', () => { | ||
assert.equal(3 * 3, 9); | ||
expect(3 * 3).toBe(9); | ||
}); | ||
}); |