diff --git a/.babelrc b/.babelrc index 3ca1979..451d3b9 100644 --- a/.babelrc +++ b/.babelrc @@ -1,4 +1,11 @@ { - "presets": ["es2015"], - "plugins": ["transform-runtime"] + "presets": [ + "@babel/preset-env" + ], + "plugins": ["@babel/plugin-transform-runtime"], + "env": { + "test": { + "plugins": [ "istanbul" ] + } + } } diff --git a/karma.conf.babel.js b/karma.conf.babel.js index b1aab61..ebd6c35 100644 --- a/karma.conf.babel.js +++ b/karma.conf.babel.js @@ -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 - } - }); }; diff --git a/karma.conf.js b/karma.conf.js index 43b69c5..a4530e0 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,2 +1,2 @@ -require('babel-register'); +require('@babel/register'); module.exports = require('./karma.conf.babel').default; diff --git a/package.json b/package.json index 7336a59..03e541c 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/test/functional/run.js b/test/functional/run.js new file mode 100644 index 0000000..a222670 --- /dev/null +++ b/test/functional/run.js @@ -0,0 +1,5 @@ +import Jasmine from 'jasmine'; + +const jasmine = new Jasmine(); +jasmine.loadConfigFile('test/functional/jasmine.json'); +jasmine.execute(); diff --git a/test/unit/run.js b/test/unit/run.js new file mode 100644 index 0000000..48b0621 --- /dev/null +++ b/test/unit/run.js @@ -0,0 +1,5 @@ +import Jasmine from 'jasmine'; + +const jasmine = new Jasmine(); +jasmine.loadConfigFile('test/unit/jasmine.json'); +jasmine.execute(); diff --git a/webpack.config.babel.js b/webpack.config.babel.js index 8c3be33..7b6a4c6 100644 --- a/webpack.config.babel.js +++ b/webpack.config.babel.js @@ -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" + } };