Update tests for modern node
- Updated Karma packages to latest versions - Switched to playwright Firefox from system Firefox due to deprecated dependencies - Switched testing script from Gulp to npm - Updated README instruction for running unit tests Change-Id: Ie338c70bed145fd1c1439eb21247c5e467083514
This commit is contained in:
parent
d244107390
commit
7f1fd02177
@ -96,7 +96,7 @@ Data should be written to :code:`stackviz-html/data/` using
|
|||||||
Testing
|
Testing
|
||||||
=======
|
=======
|
||||||
* Python tests: :code:`tox -e py36`
|
* Python tests: :code:`tox -e py36`
|
||||||
* JavaScript unit tests: :code:`gulp unit`
|
* JavaScript unit tests: :code:`npm run test`
|
||||||
* JavaScript E2E tests: :code:`gulp e2e`
|
* JavaScript E2E tests: :code:`gulp e2e`
|
||||||
|
|
||||||
Manuals & Developer Docs
|
Manuals & Developer Docs
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var path = require('path');
|
|
||||||
|
|
||||||
var gulp = require('gulp');
|
|
||||||
var karma = require('karma');
|
|
||||||
var config = require('../config');
|
|
||||||
|
|
||||||
gulp.task('unit', ['views'], function(done) {
|
|
||||||
new karma.Server({
|
|
||||||
configFile: path.join(process.cwd(), config.test.karma)
|
|
||||||
}, done).start();
|
|
||||||
});
|
|
17
package.json
17
package.json
@ -6,6 +6,9 @@
|
|||||||
"repository": "none",
|
"repository": "none",
|
||||||
"license": "Apache 2.0",
|
"license": "Apache 2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@playwright/test": "^1.41.2",
|
||||||
|
"@playwright/browser-firefox": "1.41.2",
|
||||||
|
"@types/node": "^20.11.17",
|
||||||
"angular": "1.5.2",
|
"angular": "1.5.2",
|
||||||
"angular-fontawesome": "0.4.0",
|
"angular-fontawesome": "0.4.0",
|
||||||
"angular-mocks": "1.5.2",
|
"angular-mocks": "1.5.2",
|
||||||
@ -52,14 +55,14 @@
|
|||||||
"jasmine-ajax": "3.2.0",
|
"jasmine-ajax": "3.2.0",
|
||||||
"jasmine-core": "2.4.1",
|
"jasmine-core": "2.4.1",
|
||||||
"jasmine-fixture": "2.0.0",
|
"jasmine-fixture": "2.0.0",
|
||||||
"karma": "~0.13.22",
|
"karma": "6.4.2",
|
||||||
"karma-browserify": "5.0.3",
|
"karma-browserify": "8.1.0",
|
||||||
"karma-coverage": "0.5.5",
|
"karma-coverage": "2.2.1",
|
||||||
"karma-firefox-launcher": "2.1.0",
|
"karma-firefox-launcher": "2.1.2",
|
||||||
"karma-jasmine": "0.3.8",
|
"karma-jasmine": "5.1.0",
|
||||||
"karma-subunit-reporter": "0.0.4",
|
"karma-subunit-reporter": "0.0.4",
|
||||||
"morgan": "1.7.0",
|
"morgan": "1.7.0",
|
||||||
"node-sass": "6.0.0",
|
"node-sass": "9.0.0",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"pretty-hrtime": "1.0.2",
|
"pretty-hrtime": "1.0.2",
|
||||||
"protractor": "^2.2.0",
|
"protractor": "^2.2.0",
|
||||||
@ -75,7 +78,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "if [ ! -d .venv ]; then tox -epy38 --notest; fi",
|
"postinstall": "if [ ! -d .venv ]; then tox -epy38 --notest; fi",
|
||||||
"test": "gulp unit",
|
"test": "npx karma start test/karma.conf.js",
|
||||||
"lint": "eslint ./",
|
"lint": "eslint ./",
|
||||||
"prod": "gulp prod; python setup.py sdist",
|
"prod": "gulp prod; python setup.py sdist",
|
||||||
"dev": "gulp dev"
|
"dev": "gulp dev"
|
||||||
|
@ -1,19 +1,26 @@
|
|||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
var istanbul = require('browserify-istanbul');
|
var istanbul = require("browserify-istanbul");
|
||||||
var isparta = require('isparta');
|
var isparta = require("isparta");
|
||||||
|
var process = require("process");
|
||||||
module.exports = function(config) {
|
|
||||||
|
|
||||||
|
module.exports = function (config) {
|
||||||
|
process.env.FIREFOX_BIN = require("playwright").firefox.executablePath();
|
||||||
config.set({
|
config.set({
|
||||||
|
basePath: "../",
|
||||||
basePath: '../',
|
frameworks: ["jasmine", "browserify"],
|
||||||
frameworks: ['jasmine', 'browserify'],
|
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
'app/js/**/*.js': ['browserify', 'coverage']
|
"app/js/**/*.js": ["browserify", "coverage"],
|
||||||
},
|
},
|
||||||
browsers: ['Firefox'],
|
plugins: [
|
||||||
reporters: ['progress', 'subunit'],
|
require("karma-firefox-launcher"),
|
||||||
|
require("karma-jasmine"),
|
||||||
|
require("karma-browserify"),
|
||||||
|
require("karma-coverage"),
|
||||||
|
require("karma-subunit-reporter"),
|
||||||
|
],
|
||||||
|
browsers: ["FirefoxHeadless"],
|
||||||
|
reporters: ["progress", "subunit"],
|
||||||
|
|
||||||
autoWatch: true,
|
autoWatch: true,
|
||||||
singleRun: true,
|
singleRun: true,
|
||||||
@ -21,36 +28,34 @@ module.exports = function(config) {
|
|||||||
browserify: {
|
browserify: {
|
||||||
debug: true,
|
debug: true,
|
||||||
transform: [
|
transform: [
|
||||||
'bulkify',
|
"bulkify",
|
||||||
istanbul({
|
istanbul({
|
||||||
instrumenter: isparta,
|
instrumenter: isparta,
|
||||||
ignore: ['**/node_modules/**', '**/test/**']
|
ignore: ["**/node_modules/**", "**/test/**"],
|
||||||
})
|
}),
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
subunitReporter: {
|
subunitReporter: {
|
||||||
slug: true,
|
slug: true,
|
||||||
tags: ['worker-0']
|
tags: ["worker-0"],
|
||||||
},
|
},
|
||||||
|
|
||||||
proxies: {
|
proxies: {
|
||||||
'/': 'http://localhost:9876/'
|
"/": "http://localhost:9876/",
|
||||||
},
|
},
|
||||||
|
|
||||||
urlRoot: '/__karma__/',
|
urlRoot: "/__karma__/",
|
||||||
|
|
||||||
files: [
|
files: [
|
||||||
// app-specific code
|
// app-specific code
|
||||||
'app/js/main.js',
|
"app/js/main.js",
|
||||||
|
|
||||||
// 3rd-party resources
|
// 3rd-party resources
|
||||||
'node_modules/angular-mocks/angular-mocks.js',
|
"node_modules/angular-mocks/angular-mocks.js",
|
||||||
|
|
||||||
// test files
|
// test files
|
||||||
'test/unit/**/*.js'
|
"test/unit/**/*.js",
|
||||||
]
|
],
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user