Update babel, webpack, karma, jasmine and istanbul

Update to babel v7 and webpack v4

Remove runtime depend on corejs-2 which is
unsupported. Just switch to runtime which requires polyfills be
provided by the end user.

Remove NSP - the service is being shut down and the important bits
are built in to npm now.

istanbul has been replaced by the nyc runner. Update karma
to latest.

Update yaml-loader and json-loader

Disable browser testing for now - we'll bring it back in a followup.

Change-Id: I45d1f77bb43e5d67f4154c5149fac77b853e3686
This commit is contained in:
Monty Taylor 2020-05-25 10:06:38 -05:00
parent 8354146c11
commit 7f843d7ecb
7 changed files with 64 additions and 47 deletions

View File

@ -1,4 +1,11 @@
{
"presets": ["es2015"],
"plugins": ["transform-runtime"]
"presets": [
"@babel/preset-env"
],
"plugins": ["@babel/plugin-transform-runtime"],
"env": {
"test": {
"plugins": [ "istanbul" ]
}
}
}

View File

@ -33,7 +33,7 @@ export default (config) => {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage', 'threshold'],
reporters: ['progress', 'coverage'],
// web server port
port: 9876,
@ -73,13 +73,5 @@ export default (config) => {
dir: '../../cover/' + testDir + '/browser/' //path to created html doc
},
// The current coverage threshold values. These should never drop.
thresholdReporter: {
statements: 88,
branches: 64,
functions: 77,
lines: 75
}
});
};

View File

@ -1,2 +1,2 @@
require('babel-register');
require('@babel/register');
module.exports = require('./karma.conf.babel').default;

View File

@ -5,15 +5,14 @@
"main": "dist/index.js",
"scripts": {
"configure-devstack": "babel-node ./configure-devstack.js",
"test": "npm run test:node; npm run test:browser",
"test:node": "istanbul cover jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
"test": "npm run test:node",
"test:node": "nyc babel-node test/unit/run.js",
"test:browser": "karma start",
"posttest:node": "istanbul check-coverage",
"posttest:node": "nyc check-coverage",
"functional-test": "npm run functional-test:node ; npm run functional-test:browser",
"functional-test:node": "istanbul cover --dir cover/functional/node jasmine JASMINE_CONFIG_PATH=test/functional/jasmine.json",
"functional-test:node": "nyc --dir cover/functional/node babel-node test/functional/run.js",
"functional-test:browser": "karma start --basePath test/functional/",
"lint": "eslint ./",
"prepublish": "nsp check; npm run build",
"build": "babel src -d dist && webpack",
"docs": "npm run jsdoc; (cd ./doc && make html)",
"jsdoc": "jsdoc -t node_modules/jsdoc-sphinx/template -d ./doc/source/jsdoc ./src"
@ -29,39 +28,41 @@
"license": "Apache-2.0",
"homepage": "http://www.openstack.org/",
"dependencies": {
"babel-runtime": "^6.11.6",
"@babel/runtime": "^7.0.0",
"isomorphic-fetch": "^2.2.1",
"loglevel": "^1.4.1",
"url-parse": "^1.1.3"
},
"devDependencies": {
"babel-cli": "^6.10.1",
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/node": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-loader": "^8.1.0",
"babel-plugin-istanbul": "^6.0.0",
"babel-plugin-transform-inline-environment-variables": "^6.8.0",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.9.0",
"eslint": "^3.0.0",
"eslint-config-openstack": "4.0.1",
"fetch-mock": "^5.0.5",
"istanbul": "^1.0.0-alpha.2",
"jasmine": "^2.4.1",
"jasmine-core": "^2.4.1",
"js-yaml": "^3.6.1",
"jasmine": "^3.5.0",
"js-yaml": "^3.14.0",
"jsdoc": "^3.4.0",
"jsdoc-sphinx": "0.0.6",
"json-loader": "^0.5.4",
"karma": "^1.1.1",
"karma-chrome-launcher": "^1.0.1",
"karma-coverage": "^1.1.0",
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-threshold-reporter": "^0.1.15",
"karma-webpack": "^1.7.0",
"nsp": "^2.4.0",
"webpack": "^1.13.1",
"yaml-loader": "^0.4.0"
"json-loader": "^0.5.7",
"karma": "^5.0.9",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-coverage": "^2.0.2",
"karma-firefox-launcher": "^1.3.0",
"karma-jasmine": "^3.1.1",
"karma-webpack": "^4.0.2",
"nyc": "^15.0.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"yaml-loader": "^0.6.0"
},
"files": [
"dist"

5
test/functional/run.js Normal file
View File

@ -0,0 +1,5 @@
import Jasmine from 'jasmine';
const jasmine = new Jasmine();
jasmine.loadConfigFile('test/functional/jasmine.json');
jasmine.execute();

5
test/unit/run.js Normal file
View File

@ -0,0 +1,5 @@
import Jasmine from 'jasmine';
const jasmine = new Jasmine();
jasmine.loadConfigFile('test/unit/jasmine.json');
jasmine.execute();

View File

@ -1,28 +1,35 @@
import path from 'path';
import webpack from 'webpack';
import cloudsYamlPath from './test/functional/helpers/cloudsYamlPath';
export default {
entry: ['./src/index.js'],
output: {
path: './dist',
path: path.resolve(__dirname, 'dist'),
filename: 'js-openstack-lib.js',
library: 'JSOpenStackLib',
libraryTarget: 'umd'
},
module: {
loaders: [
rules: [
{
test: /\.js$/,
loader: 'babel',
test: /\.m?js$/,
exclude: /node_modules/,
query: {
plugins: ['transform-inline-environment-variables']
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ['transform-inline-environment-variables']
}
}
}
]
],
},
plugins: [
new webpack.NormalModuleReplacementPlugin(/helpers\/cloudsConfig/,
'json!yaml!' + cloudsYamlPath)
]
],
node: {
fs: "empty"
}
};