diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 3d36bc0fb..000000000 --- a/.babelrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "presets": ["es2015"], - "retainLines": true -} diff --git a/.travis.yml b/.travis.yml index 0658f7ab1..95c0c269f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,9 @@ sudo: false language: node_js node_js: - 4 - - 5 - - 7 + - 6 - 8 + - 9 env: global: @@ -14,7 +14,7 @@ env: matrix: fast_finish: true include: - - node_js: "6" + - node_js: "8" env: VALIDATE_COMMIT_MSG=true LINT=true before_install: diff --git a/appveyor.yml b/appveyor.yml index 2068d8947..150f49eb8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,9 +3,7 @@ version: "{build}" environment: matrix: - nodejs_version: "4" - - nodejs_version: "5" - nodejs_version: "6" - - nodejs_version: "7" - nodejs_version: "8" matrix: diff --git a/docs/config/01-configuration-file.md b/docs/config/01-configuration-file.md index 6deb8c1f6..742f4509a 100644 --- a/docs/config/01-configuration-file.md +++ b/docs/config/01-configuration-file.md @@ -522,6 +522,8 @@ See [plugins] for more information. **Description:** The port where the web server will be listening. +If the defined port is already in use, karma will automatically increase its value in steps of 1 until a free port is found. + ## processKillTimeout **Type:** Number diff --git a/gruntfile.js b/gruntfile.js index e92844ff4..0a1b6f1ce 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -31,7 +31,6 @@ module.exports = function (grunt) { }, mochaTest: { options: { - require: 'babel-register', reporter: 'dot', ui: 'bdd', quiet: false, diff --git a/lib/config.js b/lib/config.js index f41860bb9..e77fecfd4 100644 --- a/lib/config.js +++ b/lib/config.js @@ -365,7 +365,6 @@ var CONFIG_SYNTAX_HELP = ' module.exports = function(config) {\n' + var parseConfig = function (configFilePath, cliOptions) { var configModule if (configFilePath) { - log.debug('Loading config %s', configFilePath) try { configModule = require(configFilePath) @@ -397,7 +396,6 @@ var parseConfig = function (configFilePath, cliOptions) { return process.exit(1) } } else { - log.debug('No config file specified.') // if no config file path is passed, we define a dummy config module. configModule = function () {} } @@ -441,6 +439,12 @@ var parseConfig = function (configFilePath, cliOptions) { // configure the logger as soon as we can logger.setup(config.logLevel, config.colors, config.loggers) + if (configFilePath) { + log.debug('Loading config %s', configFilePath) + } else { + log.debug('No config file specified.') + } + return normalizeConfig(config, configFilePath) } diff --git a/lib/file-list.js b/lib/file-list.js index 2645e855b..726c920ae 100644 --- a/lib/file-list.js +++ b/lib/file-list.js @@ -7,9 +7,6 @@ // Dependencies // ------------ -var Map = require('core-js/library/fn/map') -var Set = require('core-js/library/fn/set') -var from = require('core-js/library/fn/array/from') var Promise = require('bluebird') var mm = require('minimatch') var Glob = require('glob').Glob @@ -120,7 +117,7 @@ List.prototype._findFile = function (path, pattern) { if (!path || !pattern) return if (!this.buckets.has(pattern.pattern)) return - return _.find(from(this.buckets.get(pattern.pattern)), function (file) { + return _.find(Array.from(this.buckets.get(pattern.pattern)), function (file) { return file.originalPath === path }) } @@ -229,7 +226,7 @@ Object.defineProperty(List.prototype, 'files', { } var expandPattern = function (p) { - return from(self.buckets.get(p.pattern) || []).sort(byPath) + return Array.from(self.buckets.get(p.pattern) || []).sort(byPath) } var served = this._patterns.filter(function (pattern) { diff --git a/lib/launcher.js b/lib/launcher.js index be15dcf56..56292e1bf 100644 --- a/lib/launcher.js +++ b/lib/launcher.js @@ -43,6 +43,7 @@ var Launcher = function (server, emitter, injector) { this.launchSingle = function (protocol, hostname, port, urlRoot, upstreamProxy, processKillTimeout) { var self = this return function (name) { + name = (name + '').trim(); if (upstreamProxy) { protocol = upstreamProxy.protocol hostname = upstreamProxy.hostname diff --git a/lib/middleware/source_files.js b/lib/middleware/source_files.js index 34395f63d..46fbfe0c6 100644 --- a/lib/middleware/source_files.js +++ b/lib/middleware/source_files.js @@ -1,4 +1,3 @@ -var from = require('core-js/library/fn/array/from') var querystring = require('querystring') var _ = require('lodash') @@ -8,17 +7,17 @@ var log = logger.create('middleware:source-files') // Files is a Set var findByPath = function (files, path) { - return _.find(from(files), function (file) { + return _.find(Array.from(files), function (file) { return file.path === path }) } var composeUrl = function (url, basePath, urlRoot, mustEscape) { return (mustEscape ? querystring.unescape(url) : url) - .replace(urlRoot, '/') - .replace(/\?.*$/, '') - .replace(/^\/absolute/, '') - .replace(/^\/base/, basePath) + .replace(urlRoot, '/') + .replace(/\?.*$/, '') + .replace(/^\/absolute/, '') + .replace(/^\/base/, basePath) } // Source Files middleware is responsible for serving all the source files under the test. diff --git a/lib/reporter.js b/lib/reporter.js index 75d7bb5a6..546571db6 100644 --- a/lib/reporter.js +++ b/lib/reporter.js @@ -1,7 +1,6 @@ var util = require('util') var resolve = require('url').resolve var SourceMapConsumer = require('source-map').SourceMapConsumer -var WeakMap = require('core-js/es6/weak-map') var _ = require('lodash') var log = require('./logger').create('reporter') diff --git a/package.json b/package.json index f00fd4aa8..c6faad3a1 100644 --- a/package.json +++ b/package.json @@ -350,25 +350,23 @@ "range-parser": "^1.2.0", "rimraf": "^2.6.0", "safe-buffer": "^5.0.1", - "socket.io": "2.0.3", - "source-map": "^0.5.3", - "tmp": "0.0.31", + "socket.io": "2.0.4", + "source-map": "^0.6.1", + "tmp": "0.0.33", "useragent": "^2.1.12" }, "devDependencies": { "LiveScript": "^1.3.0", - "babel": "^6.23.0", - "babel-preset-es2015": "^6.22.0", - "babel-register": "^6.23.0", - "chai": "^3.3.0", - "chai-as-promised": "^6.0.0", + "babel-core": "^6.26.0", + "chai": "^4.1.2", + "chai-as-promised": "^7.1.1", "chai-subset": "^1.2.2", - "coffee-script": "^1.12.4", - "cucumber": "^2.2.0", - "eslint": "^3.15.0", + "coffeescript": "^1.12.7", + "cucumber": "^3.1.0", + "eslint": "^4.11.0", "eslint-config-standard": "^10.2.1", "eslint-plugin-import": "^2.2.0", - "eslint-plugin-node": "^4.2.2", + "eslint-plugin-node": "^5.2.1", "eslint-plugin-promise": "^3.4.2", "eslint-plugin-react": "^7.0.1", "eslint-plugin-standard": "^3.0.1", @@ -380,12 +378,12 @@ "grunt-contrib-watch": "^1.0.0", "grunt-conventional-changelog": "^6.0.1", "grunt-conventional-github-releaser": "^1.0.0", - "grunt-cucumberjs": "^1.0.0", - "grunt-eslint": "^19.0.0", + "grunt-cucumberjs": "^2.0.2", + "grunt-eslint": "^20.1.0", "grunt-mocha-test": "^0.13.2", "grunt-npm": "0.0.2", "http2": "^3.3.6", - "husky": "^0.13.1", + "husky": "^0.14.3", "jasmine-core": "^2.3.4", "json3": "^3.3.2", "karma-browserify": "^5.0.1", @@ -411,13 +409,13 @@ "karma-script-launcher": "^1.0.0", "load-grunt-tasks": "^3.1.0", "mkdirp": "^0.5.0", - "mocha": "^3.2.0", + "mocha": "^4.0.1", "mocks": "^0.0.15", "phantomjs-prebuilt": "^2.1.3", "proxyquire": "^1.7.11", "qunitjs": "^2.1.1", "requirejs": "^2.1.20", - "sinon": "^2.2.0", + "sinon": "^4.1.2", "sinon-chai": "^2.7.0", "supertest": "^3.0.0", "timer-shim": "^0.3.0", @@ -434,7 +432,7 @@ "version": "1.7.1", "license": "MIT", "scripts": { - "lint": "eslint client/**/*.js common/**/*.js context/**/*.js gruntfile.js wallaby.js lib/**/*.js test/**/*.js static/debug.js", + "lint": "eslint client/**/*.js common/**/*.js context/**/*.js gruntfile.js wallaby.js lib/**/*.js test/unit/**/*.js test/client/*.js test/e2e/**/*.js static/debug.js", "test": "grunt test", "build": "grunt build", "test:appveyor": "grunt test-appveyor", diff --git a/test/e2e/step_definitions/core_steps.js b/test/e2e/step_definitions/core_steps.js index 96e7e8b00..dbd638d0b 100644 --- a/test/e2e/step_definitions/core_steps.js +++ b/test/e2e/step_definitions/core_steps.js @@ -1,13 +1,17 @@ -var {defineSupportCode} = require('cucumber') +var cucumber = require('cucumber') +var fs = require('fs') +var path = require('path') +var ref = require('child_process') +var exec = ref.exec +var spawn = ref.spawn +var rimraf = require('rimraf') +var stopper = require('../../../lib/stopper') -defineSupportCode(function ({defineParameterType, Given, Then, When}) { - var fs = require('fs') - var path = require('path') - var ref = require('child_process') - var exec = ref.exec - var spawn = ref.spawn - var rimraf = require('rimraf') - var stopper = require('../../../lib/stopper') +cucumber.defineSupportCode((a) => { + var When = a.When + var Then = a.Then + var Given = a.Given + var defineParameterType = a.defineParameterType var baseDir = fs.realpathSync(path.join(__dirname, '/../../..')) var tmpDir = path.join(baseDir, 'tmp', 'sandbox') @@ -28,13 +32,94 @@ defineSupportCode(function ({defineParameterType, Given, Then, When}) { } } + function execKarma (command, level, proxyPort, proxyPath, callback) { + level = level || 'warn' + + var startProxy = (done) => { + if (proxyPort) { + this.proxy.start(proxyPort, proxyPath, done) + } else { + done() + } + } + + startProxy((err) => { + if (err) { + return callback.fail(err) + } + + this.writeConfigFile(tmpDir, tmpConfigFile, (err, hash) => { + if (err) { + return callback.fail(new Error(err)) + } + var configFile = path.join(tmpDir, hash + '.' + tmpConfigFile) + var runtimePath = path.join(baseDir, 'bin', 'karma') + + var executor = (done) => { + var cmd = runtimePath + ' ' + command + ' --log-level ' + level + ' ' + configFile + ' ' + additionalArgs + + return exec(cmd, { + cwd: baseDir + }, done) + } + + var runOut = command === 'runOut' + if (command === 'run' || command === 'runOut') { + this.child = spawn('' + runtimePath, ['start', '--log-level', 'warn', configFile]) + var done = () => { + cleansingNeeded = true + this.child && this.child.kill() + callback() + } + + this.child.on('error', (error) => { + this.lastRun.error = error + done() + }) + + this.child.stderr.on('data', (chunk) => { + this.lastRun.stderr += chunk.toString() + }) + + this.child.stdout.on('data', (chunk) => { + this.lastRun.stdout += chunk.toString() + var cmd = runtimePath + ' run ' + configFile + ' ' + additionalArgs + setTimeout(() => { + exec(cmd, { + cwd: baseDir + }, (error, stdout) => { + if (error) { + this.lastRun.error = error + } + if (runOut) { + this.lastRun.stdout = stdout + } + done() + }) + }, 1000) + }) + } else { + executor((error, stdout, stderr) => { + if (error) { + this.lastRun.error = error + } + this.lastRun.stdout = stdout + this.lastRun.stderr = stderr + cleansingNeeded = true + callback() + }) + } + }) + }) + } + Given('a configuration with:', function (fileContent, callback) { cleanseIfNeeded() this.addConfigContent(fileContent) return callback() }) - Given('command line arguments of: {stringInDoubleQuotes}', function (args, callback) { + Given('command line arguments of: {string}', function (args, callback) { additionalArgs = args return callback() }) @@ -70,86 +155,34 @@ defineSupportCode(function ({defineParameterType, Given, Then, When}) { })(this)) }) - When("I {run|runOut|start|init|stop} Karma( with log-level {string})( behind a proxy on port {int} that prepends '{string}' to the base path)", function (command, level, proxyPort, proxyPath, callback) { - var startProxy = function (done) { - if (proxyPort) { - this.proxy.start(proxyPort, proxyPath, done) - } else { - done() - } - } - startProxy.call(this, (function (_this) { - return function (err) { - if (err) { - return callback.fail(err) - } - _this.writeConfigFile(tmpDir, tmpConfigFile, function (err, hash) { - if (err) { - return callback.fail(new Error(err)) - } - level = level || 'warn' - var configFile = path.join(tmpDir, hash + '.' + tmpConfigFile) - var runtimePath = path.join(baseDir, 'bin', 'karma') - var execKarma = function (done) { - var cmd = runtimePath + ' ' + command + ' --log-level ' + level + ' ' + configFile + ' ' + additionalArgs - - return exec(cmd, { - cwd: baseDir - }, done) - } - var runOut = command === 'runOut' - if (command === 'run' || command === 'runOut') { - _this.child = spawn('' + runtimePath, ['start', '--log-level', 'warn', configFile]) - var done = function () { - cleansingNeeded = true - _this.child && _this.child.kill() - callback() - } + defineParameterType({ + name: 'command', + regexp: /run|runOut|start|init|stop/ + }) - _this.child.on('error', function (error) { - _this.lastRun.error = error - done() - }) - - _this.child.stderr.on('data', function (chunk) { - _this.lastRun.stderr += chunk.toString() - }) - - _this.child.stdout.on('data', function (chunk) { - _this.lastRun.stdout += chunk.toString() - var cmd = runtimePath + ' run ' + configFile + ' ' + additionalArgs - - setTimeout(function () { - exec(cmd, { - cwd: baseDir - }, function (error, stdout) { - if (error) { - _this.lastRun.error = error - } - if (runOut) { - _this.lastRun.stdout = stdout - } - done() - }) - }, 1000) - }) - } else { - execKarma(function (error, stdout, stderr) { - if (error) { - _this.lastRun.error = error - } - _this.lastRun.stdout = stdout - _this.lastRun.stderr = stderr - cleansingNeeded = true - callback() - }) - } - }) - } - })(this)) + defineParameterType({ + name: 'loglevel', + regexp: /info|error|warn|debug/ + }) + + When('I {command} Karma', function (command, callback) { + execKarma.apply(this, [command, undefined, undefined, undefined, callback]) + }) + + When('I {command} Karma with log-level {loglevel}', function (command, level, callback) { + execKarma.apply(this, [command, level, undefined, undefined, callback]) }) - Then('it passes with( {no debug|like}):', {timeout: 10 * 1000}, function (mode, expectedOutput, callback) { + When('I {command} Karma behind a proxy on port {int} that prepends {string} to the base path', function (command, proxyPort, proxyPath, callback) { + execKarma.apply(this, [command, undefined, proxyPort, proxyPath, callback]) + }) + + defineParameterType({ + name: 'exact', + regexp: /no\sdebug|like/ + }) + + Then('it passes with( {exact}):', {timeout: 10 * 1000}, function (mode, expectedOutput, callback) { var noDebug = mode === 'no debug' var like = mode === 'like' var actualOutput = this.lastRun.stdout.toString() @@ -203,7 +236,12 @@ defineSupportCode(function ({defineParameterType, Given, Then, When}) { } }) - Then('The {server|stopper} is dead( with exit code {int})', + defineParameterType({ + name: 'component', + regexp: /server|stopper/ + }) + + Then('The {component} is dead( with exit code {int})', function (stopperOrServer, code, callback) { var server = stopperOrServer === 'server' var _this = this @@ -215,7 +253,7 @@ defineSupportCode(function ({defineParameterType, Given, Then, When}) { }, 4000) }) - Then('the file at {string} contains:', + Then(/^the file at ([a-zA-Z0-9/\\_.]+) contains:$/, function (filePath, expectedOutput, callback) { var data = fs.readFileSync(filePath, {encoding: 'UTF-8'}) if (data.match(expectedOutput)) { diff --git a/test/e2e/step_definitions/hooks.js b/test/e2e/step_definitions/hooks.js index 9be4aa5ce..48e0e30ad 100644 --- a/test/e2e/step_definitions/hooks.js +++ b/test/e2e/step_definitions/hooks.js @@ -1,7 +1,7 @@ -var {defineSupportCode} = require('cucumber') +var cucumber = require('cucumber') -defineSupportCode(function ({After}) { - After(function (scenario, callback) { +cucumber.defineSupportCode((a) => { + a.After(function (scenario, callback) { var running = this.child != null && typeof this.child.kill === 'function' if (running) { diff --git a/test/e2e/support/env.js b/test/e2e/support/env.js index e58cd18c9..566e5e7cb 100644 --- a/test/e2e/support/env.js +++ b/test/e2e/support/env.js @@ -1,5 +1,5 @@ -var {defineSupportCode} = require('cucumber') +var cucumber = require('cucumber') -defineSupportCode(function ({setDefaultTimeout}) { - setDefaultTimeout(60 * 1000) +cucumber.defineSupportCode((a) => { + a.setDefaultTimeout(60 * 1000) }) diff --git a/test/e2e/support/world.js b/test/e2e/support/world.js index 584b3bbd7..69d28c185 100644 --- a/test/e2e/support/world.js +++ b/test/e2e/support/world.js @@ -4,7 +4,7 @@ var path = require('path') var hasher = require('crypto').createHash var mkdirp = require('mkdirp') var _ = require('lodash') -var {defineSupportCode} = require('cucumber') +var cucumber = require('cucumber') function World () { this.proxy = require('./proxy') @@ -63,6 +63,6 @@ function World () { } } -defineSupportCode(function ({setWorldConstructor}) { - setWorldConstructor(World) +cucumber.defineSupportCode((a) => { + a.setWorldConstructor(World) }) diff --git a/test/unit/cli.spec.js b/test/unit/cli.spec.js index a48707776..04744d96d 100644 --- a/test/unit/cli.spec.js +++ b/test/unit/cli.spec.js @@ -1,8 +1,10 @@ -import cli from '../../lib/cli' -import optimist from 'optimist' -import path from 'path' -import constant from '../../lib/constants' -import mocks from 'mocks' +var optimist = require('optimist') +var path = require('path') +var mocks = require('mocks') + +var cli = require('../../lib/cli') +var constant = require('../../lib/constants') + var loadFile = mocks.loadFile describe('cli', () => { diff --git a/test/unit/config.spec.js b/test/unit/config.spec.js index f2c65a41b..f9cae34f8 100644 --- a/test/unit/config.spec.js +++ b/test/unit/config.spec.js @@ -1,4 +1,4 @@ -import path from 'path' +var path = require('path') var loadFile = require('mocks').loadFile var helper = require('../../lib/helper') var logger = require('../../lib/logger.js') @@ -123,10 +123,8 @@ describe('config', () => { expect(logSpy).to.have.been.called var event = logSpy.lastCall.args - expect(event).to.be.deep.equal([ - 'Error in config file!\n', - new SyntaxError('Unexpected token =') - ]) + expect(event[0]).to.eql('Error in config file!\n') + expect(event[1].message).to.eql('Unexpected token =') expect(mocks.process.exit).to.have.been.calledWith(1) }) @@ -423,7 +421,9 @@ describe('config', () => { describe('custom', () => { var di = require('di') - var forwardArgsFactory = (args) => args + var forwardArgsFactory = function (args) { + return args + } var baseModule = { 'preprocessor:base': ['type', forwardArgsFactory], @@ -445,7 +445,7 @@ describe('config', () => { var injector = new di.Injector([baseModule].concat(config.plugins)) var injectedArgs = injector.get('launcher:custom') - expect(injectedArgs).to.be.defined + expect(injectedArgs).to.exist expect(injectedArgs.first).to.equal(123) expect(injectedArgs.whatever).to.equal('aaa') }) @@ -464,7 +464,7 @@ describe('config', () => { var injector = new di.Injector([baseModule].concat(config.plugins)) var injectedArgs = injector.get('preprocessor:custom') - expect(injectedArgs).to.be.defined + expect(injectedArgs).to.exist expect(injectedArgs.second).to.equal(123) expect(injectedArgs.whatever).to.equal('bbb') }) @@ -483,7 +483,7 @@ describe('config', () => { var injector = new di.Injector([baseModule].concat(config.plugins)) var injectedArgs = injector.get('reporter:custom') - expect(injectedArgs).to.be.defined + expect(injectedArgs).to.exist expect(injectedArgs.third).to.equal(123) expect(injectedArgs.whatever).to.equal('ccc') }) diff --git a/test/unit/emitter_wrapper.spec.js b/test/unit/emitter_wrapper.spec.js index 1692ebac8..d8aecce8c 100644 --- a/test/unit/emitter_wrapper.spec.js +++ b/test/unit/emitter_wrapper.spec.js @@ -1,5 +1,6 @@ -import EmitterWrapper from '../../lib/emitter_wrapper' -import {EventEmitter} from 'events' +var EventEmitter = require('events').EventEmitter + +var EmitterWrapper = require('../../lib/emitter_wrapper') describe('emitter_wrapper', () => { var emitter diff --git a/test/unit/events.spec.js b/test/unit/events.spec.js index e058e7b57..cf35f345a 100644 --- a/test/unit/events.spec.js +++ b/test/unit/events.spec.js @@ -147,7 +147,7 @@ describe('events', () => { emitter.on('bar', spy) replyEvents() - expect(spy).to.not.have.been.caleed + expect(spy).to.not.have.been.called }) it('should work with overriden "emit" method', () => { diff --git a/test/unit/file-list.spec.js b/test/unit/file-list.spec.js index 97b1b90b6..9a6ad1af0 100644 --- a/test/unit/file-list.spec.js +++ b/test/unit/file-list.spec.js @@ -1,23 +1,24 @@ -import Promise from 'bluebird' -import {EventEmitter} from 'events' -import mocks from 'mocks' -import proxyquire from 'proxyquire' -import pathLib from 'path' -import _ from 'lodash' -import from from 'core-js/library/fn/array/from' +var Promise = require('bluebird') +var EventEmitter = require('events').EventEmitter +var mocks = require('mocks') +var proxyquire = require('proxyquire') +var pathLib = require('path') +var _ = require('lodash') -import helper from '../../lib/helper' -import config from '../../lib/config' +var helper = require('../../lib/helper') +var config = require('../../lib/config') // create an array of pattern objects from given strings -var patterns = (...strings) => strings.map((str) => new config.Pattern(str)) +var patterns = function () { + return Array.from(arguments).map((str) => new config.Pattern(str)) +} function pathsFrom (files) { - return _.map(from(files), 'path') + return _.map(Array.from(files), 'path') } function findFile (path, files) { - return from(files).find((file) => file.path === path) + return Array.from(files).find((file) => file.path === path) } var PATTERN_LIST = { @@ -71,10 +72,12 @@ describe('FileList', () => { emitter = new EventEmitter() glob = { - Glob: (pattern, opts) => ({ - found: patternList[pattern], - statCache: mg.statCache - }) + Glob: function (pattern, opts) { + return { + found: patternList[pattern], + statCache: mg.statCache + } + } } List = proxyquire('../../lib/file-list', { @@ -104,7 +107,7 @@ describe('FileList', () => { it('returns only served files', () => { var files = [ - new config.Pattern('/a.*', true), // served: true + new config.Pattern('/a.*', true), // served: true new config.Pattern('/some/*.js', false) // served: false ] @@ -117,7 +120,7 @@ describe('FileList', () => { it('marks no cache files', () => { var files = [ - new config.Pattern('/a.*'), // nocach: false + new config.Pattern('/a.*'), // nocach: false new config.Pattern('/some/*.js', true, true, true, true) // nocache: true ] @@ -201,10 +204,12 @@ describe('FileList', () => { emitter = new EventEmitter() glob = { - Glob: (pattern, opts) => ({ - found: patternList[pattern], - statCache: mg.statCache - }) + Glob: function (pattern, opts) { + return { + found: patternList[pattern], + statCache: mg.statCache + } + } } List = proxyquire('../../lib/file-list', { @@ -238,10 +243,12 @@ describe('FileList', () => { emitter = new EventEmitter() glob = { - Glob: (pattern, opts) => ({ - found: patternList[pattern], - statCache: mg.statCache - }) + Glob: function (pattern, opts) { + return { + found: patternList[pattern], + statCache: mg.statCache + } + } } List = proxyquire('../../lib/file-list', { @@ -363,8 +370,7 @@ describe('FileList', () => { var file = findFile('http://some.com', bucket) expect(file).to.have.property('isUrl', true) - } - ) + }) }) it('preprocesses all files', () => { @@ -416,8 +422,7 @@ describe('FileList', () => { ]) .then(() => { expect(list._refresh).to.have.been.calledTwice - } - ) + }) }) }) @@ -432,10 +437,12 @@ describe('FileList', () => { emitter = new EventEmitter() glob = { - Glob: (pattern, opts) => ({ - found: patternList[pattern], - statCache: mg.statCache - }) + Glob: function (pattern, opts) { + return { + found: patternList[pattern], + statCache: mg.statCache + } + } } clock = sinon.useFakeTimers() @@ -559,10 +566,12 @@ describe('FileList', () => { emitter = new EventEmitter() glob = { - Glob: (pattern, opts) => ({ - found: patternList[pattern], - statCache: mg.statCache - }) + Glob: function (pattern, opts) { + return { + found: patternList[pattern], + statCache: mg.statCache + } + } } clock = sinon.useFakeTimers() @@ -666,10 +675,12 @@ describe('FileList', () => { emitter = new EventEmitter() glob = { - Glob: (pattern, opts) => ({ - found: patternList[pattern], - statCache: mg.statCache - }) + Glob: function (pattern, opts) { + return { + found: patternList[pattern], + statCache: mg.statCache + } + } } clock = sinon.useFakeTimers() @@ -741,16 +752,18 @@ describe('FileList', () => { beforeEach(() => { patternList = PATTERN_LIST mg = MG - Promise.setScheduler((fn) => fn()) + Promise.setScheduler(function (fn) { fn() }) preprocess = sinon.spy((file, done) => process.nextTick(done)) emitter = new EventEmitter() glob = { - Glob: (pattern, opts) => ({ - found: patternList[pattern], - statCache: mg.statCache - }) + Glob: function (pattern, opts) { + return { + found: patternList[pattern], + statCache: mg.statCache + } + } } modified = sinon.stub() @@ -873,9 +886,10 @@ describe('FileList', () => { mockFs._touchFile('/some/b.js', '2020-01-01') list.changeFile('/some/b.js') list.removeFile('/some/a.js') // /some/b.js, /a.txt - list.removeFile('/a.txt') // /some/b.js - list.addFile('/a.txt') // /some/b.js, /a.txt - list.addFile('/some/0.js').then(() => { // /some/0.js, /some/b.js, /a.txt + list.removeFile('/a.txt') // /some/b.js + list.addFile('/a.txt') // /some/b.js, /a.txt + list.addFile('/some/0.js').then(() => { + // /some/0.js, /some/b.js, /a.txt clock.tick(99) expect(modified).to.not.have.been.called mockFs._touchFile('/a.txt', '2020-01-01') diff --git a/test/unit/helper.spec.js b/test/unit/helper.spec.js index 118e7e9b3..c937bb95d 100644 --- a/test/unit/helper.spec.js +++ b/test/unit/helper.spec.js @@ -1,4 +1,4 @@ -import path from 'path' +var path = require('path') describe('helper', () => { var helper = require('../../lib/helper') diff --git a/test/unit/init.spec.js b/test/unit/init.spec.js index d38884b24..3bcdd0ef6 100644 --- a/test/unit/init.spec.js +++ b/test/unit/init.spec.js @@ -1,4 +1,5 @@ -import path from 'path' +var path = require('path') + describe('init', () => { var loadFile = require('mocks').loadFile var m = null diff --git a/test/unit/init/formatters.spec.js b/test/unit/init/formatters.spec.js index a311132f6..3a46667ca 100644 --- a/test/unit/init/formatters.spec.js +++ b/test/unit/init/formatters.spec.js @@ -1,4 +1,5 @@ -import formatters from '../../../lib/init/formatters' +var formatters = require('../../../lib/init/formatters') + describe('init/formatters', () => { var formatter @@ -8,7 +9,8 @@ describe('init/formatters', () => { }) describe('formatAnswers', () => { - var createAnswers = function (ans = {}) { + var createAnswers = function (ans) { + ans = ans || {} ans.frameworks = ans.frameworks || [] ans.files = ans.files || [] ans.onlyServedFiles = ans.onlyServedFiles || [] diff --git a/test/unit/init/state_machine.spec.js b/test/unit/init/state_machine.spec.js index f2ab7ad0e..5bd620211 100644 --- a/test/unit/init/state_machine.spec.js +++ b/test/unit/init/state_machine.spec.js @@ -1,4 +1,4 @@ -import StateMachine from '../../../lib/init/state_machine' +var StateMachine = require('../../../lib/init/state_machine') describe('init/StateMachine', () => { var done diff --git a/test/unit/launcher.spec.js b/test/unit/launcher.spec.js index aa3662599..8b69955d5 100644 --- a/test/unit/launcher.spec.js +++ b/test/unit/launcher.spec.js @@ -1,8 +1,9 @@ -import Promise from 'bluebird' -import di from 'di' -import events from '../../lib/events' -import launcher from '../../lib/launcher' -import createMockTimer from './mocks/timer' +var Promise = require('bluebird') +var di = require('di') + +var events = require('../../lib/events') +var launcher = require('../../lib/launcher') +var createMockTimer = require('./mocks/timer') // promise mock var stubPromise = (obj, method, stubAction) => { @@ -17,48 +18,44 @@ var stubPromise = (obj, method, stubAction) => { }) } -class FakeBrowser { - constructor (id, name, baseBrowserDecorator) { - this.id = id - this.name = name - this.DEFAULT_CMD = { - linux: '/script', - darwin: '/script', - win32: 'script.exe' - } - this.ENV_CMD = 'SCRIPT_BIN' - - baseBrowserDecorator(this) - FakeBrowser._instances.push(this) - sinon.stub(this, 'start').callsFake(() => { - this.state = this.STATE_BEING_CAPTURED - this._done() - }) - stubPromise(this, 'forceKill') - sinon.stub(this, 'restart') +function FakeBrowser (id, name, baseBrowserDecorator) { + this.id = id + this.name = name + this.DEFAULT_CMD = { + linux: '/script', + darwin: '/script', + win32: 'script.exe' } + this.ENV_CMD = 'SCRIPT_BIN' + + baseBrowserDecorator(this) + FakeBrowser._instances.push(this) + sinon.stub(this, 'start').callsFake(() => { + this.state = this.STATE_BEING_CAPTURED + this._done() + }) + stubPromise(this, 'forceKill') + sinon.stub(this, 'restart') } -class ScriptBrowser { - constructor (id, name, baseBrowserDecorator) { - this.id = id - this.name = name - this.DEFAULT_CMD = { - linux: '/script', - darwin: '/script', - win32: 'script.exe' - } - this.ENV_CMD = 'SCRIPT_BIN' - - baseBrowserDecorator(this) - ScriptBrowser._instances.push(this) - sinon.stub(this, 'start').callsFake(() => { - this.state = this.STATE_BEING_CAPTURED - this._done() - }) - stubPromise(this, 'forceKill') - sinon.stub(this, 'restart') +function ScriptBrowser (id, name, baseBrowserDecorator) { + this.id = id + this.name = name + this.DEFAULT_CMD = { + linux: '/script', + darwin: '/script', + win32: 'script.exe' } + this.ENV_CMD = 'SCRIPT_BIN' + + baseBrowserDecorator(this) + ScriptBrowser._instances.push(this) + sinon.stub(this, 'start').callsFake(() => { + this.state = this.STATE_BEING_CAPTURED + this._done() + }) + stubPromise(this, 'forceKill') + sinon.stub(this, 'restart') } describe('launcher', () => { diff --git a/test/unit/launchers/base.spec.js b/test/unit/launchers/base.spec.js index 8357770dc..89408defd 100644 --- a/test/unit/launchers/base.spec.js +++ b/test/unit/launchers/base.spec.js @@ -1,7 +1,7 @@ -import _ from 'lodash' +var _ = require('lodash') -import BaseLauncher from '../../../lib/launchers/base' -import {EventEmitter} from '../../../lib/events' +var BaseLauncher = require('../../../lib/launchers/base') +var EventEmitter = require('../../../lib/events').EventEmitter describe('launchers/base.js', () => { var emitter diff --git a/test/unit/launchers/capture_timeout.spec.js b/test/unit/launchers/capture_timeout.spec.js index 636dfee1d..46e62debc 100644 --- a/test/unit/launchers/capture_timeout.spec.js +++ b/test/unit/launchers/capture_timeout.spec.js @@ -1,6 +1,6 @@ -import BaseLauncher from '../../../lib/launchers/base' -import CaptureTimeoutLauncher from '../../../lib/launchers/capture_timeout' -import createMockTimer from '../mocks/timer' +var BaseLauncher = require('../../../lib/launchers/base') +var CaptureTimeoutLauncher = require('../../../lib/launchers/capture_timeout') +var createMockTimer = require('../mocks/timer') describe('launchers/capture_timeout.js', () => { var timer diff --git a/test/unit/launchers/process.spec.js b/test/unit/launchers/process.spec.js index f97c28907..746747007 100644 --- a/test/unit/launchers/process.spec.js +++ b/test/unit/launchers/process.spec.js @@ -1,12 +1,12 @@ -import path from 'path' -import _ from 'lodash' - -import BaseLauncher from '../../../lib/launchers/base' -import RetryLauncher from '../../../lib/launchers/retry' -import CaptureTimeoutLauncher from '../../../lib/launchers/capture_timeout' -import ProcessLauncher from '../../../lib/launchers/process' -import {EventEmitter} from '../../../lib/events' -import createMockTimer from '../mocks/timer' +var path = require('path') +var _ = require('lodash') + +var BaseLauncher = require('../../../lib/launchers/base') +var RetryLauncher = require('../../../lib/launchers/retry') +var CaptureTimeoutLauncher = require('../../../lib/launchers/capture_timeout') +var ProcessLauncher = require('../../../lib/launchers/process') +var EventEmitter = require('../../../lib/events').EventEmitter +var createMockTimer = require('../mocks/timer') describe('launchers/process.js', () => { var emitter diff --git a/test/unit/launchers/retry.spec.js b/test/unit/launchers/retry.spec.js index 4129ec5b9..90bd69579 100644 --- a/test/unit/launchers/retry.spec.js +++ b/test/unit/launchers/retry.spec.js @@ -1,8 +1,8 @@ -import _ from 'lodash' +var _ = require('lodash') -import BaseLauncher from '../../../lib/launchers/base' -import RetryLauncher from '../../../lib/launchers/retry' -import {EventEmitter} from '../../../lib/events' +var BaseLauncher = require('../../../lib/launchers/base') +var RetryLauncher = require('../../../lib/launchers/retry') +var EventEmitter = require('../../../lib/events').EventEmitter describe('launchers/retry.js', () => { var emitter diff --git a/test/unit/logger.spec.js b/test/unit/logger.spec.js index 917aa82ab..d3ea57fcd 100644 --- a/test/unit/logger.spec.js +++ b/test/unit/logger.spec.js @@ -1,12 +1,12 @@ -import {loadFile} from 'mocks' -import path from 'path' +var loadFile = require('mocks').loadFile +var path = require('path') describe('logger', () => { var m - let configuration + var configuration beforeEach(() => { - const mockLog4Js = { + var mockLog4Js = { configure: function (config) { configuration = config } diff --git a/test/unit/middleware/karma.spec.js b/test/unit/middleware/karma.spec.js index 9804da6a0..633a92152 100644 --- a/test/unit/middleware/karma.spec.js +++ b/test/unit/middleware/karma.spec.js @@ -1,8 +1,9 @@ -import helper from '../../../lib/helper' -import constants from '../../../lib/constants' -import File from '../../../lib/file' -import Url from '../../../lib/url' -import mocks from 'mocks' +var mocks = require('mocks') + +var helper = require('../../../lib/helper') +var constants = require('../../../lib/constants') +var File = require('../../../lib/file') +var Url = require('../../../lib/url') var HttpResponseMock = mocks.http.ServerResponse var HttpRequestMock = mocks.http.ServerRequest @@ -415,7 +416,7 @@ describe('middleware.karma', () => { }) it('should update handle updated configs', (done) => { - let i = 0 + var i = 0 handler = createKarmaMiddleware( filesDeferred.promise, serveFile, diff --git a/test/unit/middleware/proxy.spec.js b/test/unit/middleware/proxy.spec.js index 9b81a27c8..73bb0f9f9 100644 --- a/test/unit/middleware/proxy.spec.js +++ b/test/unit/middleware/proxy.spec.js @@ -1,4 +1,4 @@ -import path from 'path' +var path = require('path') var httpMock = require('mocks').http var loadFile = require('mocks').loadFile diff --git a/test/unit/middleware/runner.spec.js b/test/unit/middleware/runner.spec.js index e773f1c26..9a7985fb3 100644 --- a/test/unit/middleware/runner.spec.js +++ b/test/unit/middleware/runner.spec.js @@ -1,12 +1,14 @@ -import path from 'path' -import {EventEmitter} from 'events' -import mocks from 'mocks' -import {Promise} from 'bluebird' -import Browser from '../../../lib/browser' -import BrowserCollection from '../../../lib/browser_collection' -import MultReporter from '../../../lib/reporters/multi' +var path = require('path') +var EventEmitter = require('events').EventEmitter +var mocks = require('mocks') +var Promise = require('bluebird') var _ = require('lodash') + +var Browser = require('../../../lib/browser') +var BrowserCollection = require('../../../lib/browser_collection') +var MultReporter = require('../../../lib/reporters/multi') var createRunnerMiddleware = require('../../../lib/middleware/runner').create + var HttpResponseMock = mocks.http.ServerResponse var HttpRequestMock = mocks.http.ServerRequest diff --git a/test/unit/middleware/source_files.spec.js b/test/unit/middleware/source_files.spec.js index 9b3bc3c2f..92475d373 100644 --- a/test/unit/middleware/source_files.spec.js +++ b/test/unit/middleware/source_files.spec.js @@ -1,9 +1,10 @@ -import http from 'http' -import mocks from 'mocks' -import request from 'supertest' -import helper from '../../../lib/helper' -import File from '../../../lib/file' -import {createServeFile} from '../../../lib/middleware/common' +var http = require('http') +var mocks = require('mocks') +var request = require('supertest') + +var helper = require('../../../lib/helper') +var File = require('../../../lib/file') +var createServeFile = require('../../../lib/middleware/common').createServeFile var createSourceFilesMiddleware = require('../../../lib/middleware/source_files').create describe('middleware.source_files', function () { @@ -128,8 +129,7 @@ describe('middleware.source_files', function () { .expect(200, 'js-src-a') .then(function () { return expect(next).not.to.have.been.called - } - ) + }) }) it('should send strict caching headers for js source files with sha', function () { @@ -143,8 +143,7 @@ describe('middleware.source_files', function () { .expect(200) .then(function () { return expect(next).not.to.have.been.called - } - ) + }) }) it('should send strict caching headers for js source files with sha (in basePath)', function () { @@ -174,8 +173,7 @@ describe('middleware.source_files', function () { .expect(200) .then(function () { return expect(next).not.to.have.been.called - } - ) + }) }) it('should not serve files that are not in served', function () { @@ -208,8 +206,7 @@ describe('middleware.source_files', function () { .expect(200, 'utf8-file') .then(function () { return expect(next).not.to.have.been.called - } - ) + }) }) it('should serve js source file from paths containing HTML URL encoded chars', function () { @@ -224,8 +221,7 @@ describe('middleware.source_files', function () { .expect(200, 'utf8-file') .then(function () { return expect(next).not.to.have.been.called - } - ) + }) }) it('should set content-type headers', function () { @@ -252,8 +248,7 @@ describe('middleware.source_files', function () { .expect(200, 'cached-content') .then(function () { return expect(next).not.to.have.been.called - } - ) + }) }) return it('should not use cached content if doNotCache is set', function () { @@ -270,7 +265,6 @@ describe('middleware.source_files', function () { .expect(200, 'js-source') .then(function () { return expect(next).not.to.have.been.called - } - ) + }) }) }) diff --git a/test/unit/middleware/strip_host.spec.js b/test/unit/middleware/strip_host.spec.js index 39681533a..5983e61c8 100644 --- a/test/unit/middleware/strip_host.spec.js +++ b/test/unit/middleware/strip_host.spec.js @@ -1,4 +1,4 @@ -import mocks from 'mocks' +var mocks = require('mocks') describe('middleware.strip_host', function () { var nextSpy diff --git a/test/unit/mocks/timer.js b/test/unit/mocks/timer.js index 943201fd3..8abb35e9b 100644 --- a/test/unit/mocks/timer.js +++ b/test/unit/mocks/timer.js @@ -1,4 +1,4 @@ -import {Timer} from 'timer-shim' +var Timer = require('timer-shim').Timer module.exports = function () { var timer = new Timer() diff --git a/test/unit/preprocessor.spec.js b/test/unit/preprocessor.spec.js index ccd488f3a..cddca6c68 100644 --- a/test/unit/preprocessor.spec.js +++ b/test/unit/preprocessor.spec.js @@ -1,7 +1,8 @@ -import mocks from 'mocks' -import di from 'di' -import path from 'path' -import events from '../../lib/events' +var mocks = require('mocks') +var di = require('di') +var path = require('path') + +var events = require('../../lib/events') describe('preprocessor', () => { var pp @@ -39,7 +40,11 @@ describe('preprocessor', () => { done(null, 'new-content') }) - var injector = new di.Injector([{'preprocessor:fake': ['factory', () => fakePreprocessor]}, emitterSetting]) + var injector = new di.Injector([{ + 'preprocessor:fake': [ + 'factory', function () { return fakePreprocessor } + ] + }, emitterSetting]) pp = m.createPreprocessor({'**/*.js': ['fake']}, null, injector) var file = {originalPath: '/some/a.js', path: 'path'} @@ -58,7 +63,9 @@ describe('preprocessor', () => { done(null, 'new-content') }) - var injector = new di.Injector([{'preprocessor:fake': ['factory', () => fakePreprocessor]}, emitterSetting]) + var injector = new di.Injector([{ + 'preprocessor:fake': ['factory', function () { return fakePreprocessor } ] + }, emitterSetting]) pp = m.createPreprocessor({'**/*.js': ['fake']}, null, injector) var file = {originalPath: '/some/.dir/a.js', path: 'path'} @@ -77,7 +84,9 @@ describe('preprocessor', () => { done(null, 'new-content') }) - var injector = new di.Injector([{'preprocessor:fake': ['factory', () => fakePreprocessor]}, emitterSetting]) + var injector = new di.Injector([{ + 'preprocessor:fake': ['factory', function () { return fakePreprocessor }] + }, emitterSetting]) var config = {'**/*.txt': ['fake']} pp = m.createPreprocessor(config, null, injector) @@ -98,7 +107,9 @@ describe('preprocessor', () => { done(null, '') }) - var injector = new di.Injector([{'preprocessor:fake': ['factory', () => fakePreprocessor]}, emitterSetting]) + var injector = new di.Injector([{ + 'preprocessor:fake': ['factory', function () { return fakePreprocessor }] + }, emitterSetting]) pp = m.createPreprocessor({'**/*.js': ['fake']}, null, injector) var file = {originalPath: '/some/a.txt', path: 'path'} @@ -121,8 +132,8 @@ describe('preprocessor', () => { }) var injector = new di.Injector([{ - 'preprocessor:fake1': ['factory', () => fakePreprocessor1], - 'preprocessor:fake2': ['factory', () => fakePreprocessor2] + 'preprocessor:fake1': ['factory', function () { return fakePreprocessor1 }], + 'preprocessor:fake2': ['factory', function () { return fakePreprocessor2 }] }, emitterSetting]) pp = m.createPreprocessor({'**/*.js': ['fake1', 'fake2']}, null, injector) @@ -166,7 +177,7 @@ describe('preprocessor', () => { }) var injector = new di.Injector([{ - 'preprocessor:fake': ['factory', () => fakePreprocessor] + 'preprocessor:fake': ['factory', function () { return fakePreprocessor }] }, emitterSetting]) pp = m.createPreprocessor({'**/a.js': ['fake']}, null, injector) @@ -192,7 +203,7 @@ describe('preprocessor', () => { }) var injector = new di.Injector([{ - 'preprocessor:failing': ['factory', () => failingPreprocessor] + 'preprocessor:failing': ['factory', function () { return failingPreprocessor }] }, emitterSetting]) pp = m.createPreprocessor({'**/*.js': ['failing']}, null, injector) @@ -215,8 +226,8 @@ describe('preprocessor', () => { }) var injector = new di.Injector([{ - 'preprocessor:failing': ['factory', () => failingPreprocessor], - 'preprocessor:fake': ['factory', () => fakePreprocessor] + 'preprocessor:failing': ['factory', function () { return failingPreprocessor }], + 'preprocessor:fake': ['factory', function () { return fakePreprocessor }] }, emitterSetting]) pp = m.createPreprocessor({'**/*.js': ['failing', 'fake']}, null, injector) @@ -245,7 +256,7 @@ describe('preprocessor', () => { }) var injector = new di.Injector([{ - 'preprocessor:fake': ['factory', () => fakePreprocessor] + 'preprocessor:fake': ['factory', function () { return fakePreprocessor }] }, emitterSetting]) var pp = m.createPreprocessor({'**/*.js': ['fake']}, null, injector) @@ -283,7 +294,7 @@ describe('preprocessor', () => { }) var injector = new di.Injector([{ - 'preprocessor:fake': ['factory', () => fakePreprocessor] + 'preprocessor:fake': ['factory', function () { return fakePreprocessor }] }, emitterSetting]) pp = m.createPreprocessor({'**/*': ['fake']}, null, injector) @@ -305,7 +316,7 @@ describe('preprocessor', () => { }) var injector = new di.Injector([{ - 'preprocessor:fake': ['factory', () => fakePreprocessor] + 'preprocessor:fake': ['factory', function () { fakePreprocessor }] }, emitterSetting]) pp = m.createPreprocessor({'**/*': ['fake']}, null, injector) @@ -341,10 +352,10 @@ describe('preprocessor', () => { }) var injector = new di.Injector([{ - 'preprocessor:fakeA': ['factory', () => fakePreprocessorA], - 'preprocessor:fakeB': ['factory', () => fakePreprocessorB], - 'preprocessor:fakeC': ['factory', () => fakePreprocessorC], - 'preprocessor:fakeD': ['factory', () => fakePreprocessorD] + 'preprocessor:fakeA': ['factory', function () { return fakePreprocessorA }], + 'preprocessor:fakeB': ['factory', function () { return fakePreprocessorB }], + 'preprocessor:fakeC': ['factory', function () { return fakePreprocessorC }], + 'preprocessor:fakeD': ['factory', function () { return fakePreprocessorD }] }, emitterSetting]) pp = m.createPreprocessor({ diff --git a/test/unit/reporter.spec.js b/test/unit/reporter.spec.js index af344856b..cb8dd15c3 100644 --- a/test/unit/reporter.spec.js +++ b/test/unit/reporter.spec.js @@ -1,10 +1,12 @@ -import {EventEmitter} from 'events' -import {loadFile} from 'mocks' -import path from 'path' -import _ from 'lodash' -import sinon from 'sinon' +'use strict' -import File from '../../lib/file' +var EventEmitter = require('events').EventEmitter +var loadFile = require('mocks').loadFile +var path = require('path') +var _ = require('lodash') +var sinon = require('sinon') + +var File = require('../../lib/file') describe('reporter', () => { var m diff --git a/test/unit/reporters/base.spec.js b/test/unit/reporters/base.spec.js index ed75037ad..38efff419 100644 --- a/test/unit/reporters/base.spec.js +++ b/test/unit/reporters/base.spec.js @@ -1,4 +1,4 @@ -import path from 'path' +var path = require('path') describe('reporter', function () { var loadFile = require('mocks').loadFile diff --git a/test/unit/runner.spec.js b/test/unit/runner.spec.js index 98fcb2118..064be9aea 100644 --- a/test/unit/runner.spec.js +++ b/test/unit/runner.spec.js @@ -1,6 +1,7 @@ -import {loadFile} from 'mocks' -import constant from '../../lib/constants' -import path from 'path' +var loadFile = require('mocks').loadFile +var path = require('path') + +var constant = require('../../lib/constants') describe('runner', () => { var m diff --git a/test/unit/server.spec.js b/test/unit/server.spec.js index 248ad1f4b..c362f1aed 100644 --- a/test/unit/server.spec.js +++ b/test/unit/server.spec.js @@ -1,5 +1,5 @@ -import Server from '../../lib/server' -import BrowserCollection from '../../lib/browser_collection' +var Server = require('../../lib/server') +var BrowserCollection = require('../../lib/browser_collection') describe('server', () => { var mockConfig diff --git a/test/unit/watcher.spec.js b/test/unit/watcher.spec.js index fb07f8d7e..a3bec71bd 100644 --- a/test/unit/watcher.spec.js +++ b/test/unit/watcher.spec.js @@ -1,5 +1,5 @@ -import mocks from 'mocks' -import path from 'path' +var mocks = require('mocks') +var path = require('path') describe('watcher', () => { var config = require('../../lib/config') diff --git a/test/unit/web-server.spec.js b/test/unit/web-server.spec.js index ca7e1401e..d429e443c 100644 --- a/test/unit/web-server.spec.js +++ b/test/unit/web-server.spec.js @@ -1,11 +1,10 @@ -import 'core-js' -import {EventEmitter} from 'events' -import request from 'supertest' -import di from 'di' -import mocks from 'mocks' -import fs from 'fs' -import mime from 'mime' -import path from 'path' +var EventEmitter = require('events').EventEmitter +var request = require('supertest') +var di = require('di') +var mocks = require('mocks') +var fs = require('fs') +var mime = require('mime') +var path = require('path') describe('web-server', () => { var server