Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(modules): ensure relative paths work correctly #1

Open
wants to merge 76 commits into
base: feat/esmodule
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
a99dc52
chore: fix lint task
dignifiedquire May 6, 2017
47e52e4
chore: update contributors
dignifiedquire May 6, 2017
2a847c2
chore: release v1.7.0
dignifiedquire May 6, 2017
b0f41c7
feat(config): remove polling usage
wesleycho May 6, 2017
ec92ea9
feat(ci): disable testing of node versions below 4
wesleycho May 6, 2017
2f8c049
feat(watcher): Debounce autoWatchBatchDelay
danielcompton Feb 8, 2017
0988022
fix(file-list): Stop polluting global environment with core-js
May 8, 2017
4b60513
fix(preprocessor): retry if fs.readFile fails
ywongau May 17, 2017
357d7c0
chore(travis): only update npm in Node<5 and only to npm@3
mgol May 17, 2017
2789bf5
fix(preprocessor): throw if retry fails
ywongau May 24, 2017
a28b4d2
Merge pull request #2715 from mgol/patch-1
dignifiedquire May 28, 2017
87566d1
Merge pull request #2562 from danielcompton/feat-debounce-autowatchba…
dignifiedquire May 28, 2017
be83116
Merge pull request #2690 from JakeChampion/patch-3
dignifiedquire May 28, 2017
7bab4be
chore: update dependencies
wesleycho May 6, 2017
92a8c81
fix(preprocessor): renamed handeFile to readFileCallback
ywongau May 30, 2017
fa9fd3a
Merge pull request #2692 from wesleycho/feat/ci
dignifiedquire Jun 26, 2017
33e53b9
Merge pull request #2693 from wesleycho/feat/polling
dignifiedquire Jun 26, 2017
483bedd
Merge pull request #2689 from wesleycho/chore/deps
dignifiedquire Jun 26, 2017
264442b
feat(deps): update socket.io to `1.7.4` to avoid issue with `[email protected]`
wehriam Jun 26, 2017
545dc05
Merge pull request #2714 from ywonglanecove/fix-crash-on-read-file-error
dignifiedquire Jun 26, 2017
7feaa5c
chore(ci): validate commit message when asked, only run tests once
chrahunt Jul 9, 2017
8c98439
chore(ci): pass expected path to validate-commit-msg
chrahunt Jul 10, 2017
69978ee
Merge pull request #2767 from chrahunt/fix-travis-checks
dignifiedquire Jul 19, 2017
e56861a
test(e2e): fix tests for new cucumber-js
chrahunt Jul 9, 2017
7feaee3
feat(deps): add support for node@8
kellyjensen Jun 29, 2017
15c67c9
chore: normalize @mgols name in .mailmap
mgol Aug 15, 2017
f3e5c7f
Merge pull request #2757 from kellyjensen/master
dignifiedquire Aug 15, 2017
fafa700
Merge pull request #2765 from chrahunt/fix-e2e-tests
dignifiedquire Aug 15, 2017
523d608
feat(client): log global error stack trace
briandipalma Aug 22, 2017
a36f3eb
fix(debug-runner): support asynchronous tests in the debug runner
daanstolp Aug 25, 2017
ea32194
feat(deps): add support for node@8
kellyjensen Jun 29, 2017
66b08e6
chore: update contributors
dignifiedquire Aug 30, 2017
ee40570
chore: release v1.7.1
dignifiedquire Aug 30, 2017
e79463b
feat: update of supported node versions
johnjbarton Sep 6, 2017
0c53a74
Merge branch 'master' into 1.7.1
johnjbarton Oct 19, 2017
da67e50
Merge branch 'master' into 1.7.1
johnjbarton Oct 24, 2017
f32f9e1
chore: update @mgol's name in .mailmap
mgol Oct 25, 2017
c6206a1
test(web-server): fix http2 tests
mgol Oct 25, 2017
c96a7bd
Merge pull request #2855 from mgol/mailmap
dignifiedquire Oct 25, 2017
feadb7b
Merge pull request #2857 from mgol/node8.8-fix
dignifiedquire Oct 25, 2017
e62ed41
Merge pull request #2845 from karma-runner/1.7.1
zzo Nov 9, 2017
c1fcf42
feat(config): allow to use newer versions of CoffeeScript
NeverwinterMoon Nov 1, 2017
5a6725a
Merge pull request #2866 from NeverwinterMoon/master
johnjbarton Nov 13, 2017
ec47d81
fix(config): Workaround npm 5.4 windows bug
johnjbarton Nov 15, 2017
4d4f087
Try appveyor-retry for npm install fail on windows.
johnjbarton Nov 15, 2017
d7a064c
Try appveyor-retry in npm install, not install npm
johnjbarton Nov 15, 2017
17d5791
fix(config): Retry install with appveyor-retry.
johnjbarton Nov 15, 2017
3b7b019
fix(deps): update socket.io to version 2.0.3.
johnjbarton Nov 15, 2017
d7b725c
Merge pull request #2880 from johnjbarton/fix-2777
zzo Nov 15, 2017
0801a7f
feat(cli): Warn on commands with underscores.
johnjbarton Nov 9, 2017
35f03b3
Merge pull request #2871 from johnjbarton/feat-cli-error-check
zzo Nov 16, 2017
3bf3c60
docs(dev): Make the commit message requirements prominent.
johnjbarton Nov 17, 2017
f6f8707
fix(logging): Upgrade to log4js 2.x API. (#2868)
johnjbarton Nov 21, 2017
b8a750a
Merge pull request #2883 from karma-runner/johnjbarton-patch-4
dignifiedquire Nov 21, 2017
0330cd1
feat(middleware): added manual file type option
josh18 Nov 21, 2017
6d353dc
docs: improve comments in config.tpl.*
alesrosina Nov 22, 2017
a340dae
fix(config): Call debug log methods after setting the loglevel based …
Nov 22, 2017
e23c0d4
Merge pull request #2837 from JakeChampion/logs
dignifiedquire Nov 22, 2017
334f9fb
feat(launcher): trim whitespace in browser name
dherges Nov 24, 2017
91e916a
docs(config): Document port collision scenario.
reda-alaoui Nov 25, 2017
7bd54ed
Merge pull request #2890 from reda-alaoui/patch-1
dignifiedquire Nov 25, 2017
99fd3f0
fix(config): Call debug log methods after setting the loglevel based …
Nov 22, 2017
871d46f
feat(launcher): trim whitespace in browser name
dherges Nov 24, 2017
d93cc5f
docs(config): Document port collision scenario.
reda-alaoui Nov 25, 2017
bf25094
chore(deps): update to latest
dignifiedquire Nov 22, 2017
c3ccc5d
chore(ci): focus on even node versions
dignifiedquire Nov 22, 2017
af0efda
test(e2e): update cucumber step definitions
dignifiedquire Nov 22, 2017
0e1907d
test: improve linting and fix test on node 4
dignifiedquire Nov 24, 2017
60dfc5c
feat: drop core-js and babel where possible
dignifiedquire Nov 25, 2017
00e3f88
chore: remove yarn.lock for now
dignifiedquire Nov 25, 2017
10fac07
Merge pull request #2885 from karma-runner/prep-2
dignifiedquire Nov 25, 2017
c9e1ca9
feat: better string representation of errors
macjohnny May 17, 2017
b53929a
Merge pull request #2712 from macjohnny/patch-1
EzraBrooks Nov 27, 2017
75e5423
feat(config): add support for ES modules
wesleycho May 4, 2017
79d9716
test(modules): ensure relative paths work correctly
appsforartists May 4, 2017
fa24808
test(e2e): module-types
appsforartists Nov 21, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
<[email protected]> <[email protected]>
Michał Gołębiowski-Owczarek <[email protected]>
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
sudo: false
language: node_js
node_js:
- "0.10"
- "0.12"
- 4
- 5
- 7
- 6
- 8
- 9

env:
global:
Expand All @@ -15,13 +14,13 @@ env:
matrix:
fast_finish: true
include:
- node_js: "6"
- node_js: "8"
env: VALIDATE_COMMIT_MSG=true LINT=true

before_install:
- npm config set loglevel warn
- g++-4.8 --version
- npm install -g npm
- if [[ "`node --version`" = v4* ]]; then npm install -g npm@latest-3; fi

addons:
firefox:
Expand All @@ -37,7 +36,7 @@ before_script:
- sh -e /etc/init.d/xvfb start
- npm run init
- export $(openssl aes-256-cbc -pass env:CREDENTIALS_PASS -d -in credentials)
- 'if [ "$VALIDATE_COMMIT_MSG" == "true" ]; then npm run travis; else ./scripts/validate-commit-msg.sh $TRAVIS_COMMIT; fi'
- 'if [ "$VALIDATE_COMMIT_MSG" == "true" ]; then ./scripts/validate-commit-msg.sh $TRAVIS_COMMIT; fi'
- 'if [ "$LINT" == "true" ]; then npm run lint; fi'

script:
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
<a name="1.7.1"></a>
## [1.7.1](https://github.com/karma-runner/karma/compare/v1.7.0...v1.7.1) (2017-08-30)


### Features

* **deps:** add support for node[@8](https://github.com/8) ([ea32194](https://github.com/karma-runner/karma/commit/ea32194)), closes [#2754](https://github.com/karma-runner/karma/issues/2754)



<a name="1.7.0"></a>
# [1.7.0](https://github.com/karma-runner/karma/compare/v1.6.0...v1.7.0) (2017-05-06)


### Bug Fixes

* **middleware:** change to use vanilla for loop ([ac62cc0](https://github.com/karma-runner/karma/commit/ac62cc0)), closes [#2671](https://github.com/karma-runner/karma/issues/2671)
* **reporters:** Revert the backwards-incompatible log priority order changes ([316b944](https://github.com/karma-runner/karma/commit/316b944)), closes [#2582](https://github.com/karma-runner/karma/issues/2582)


### Features

* **runner:** Buffer stdout and stderr for output when errors occur ([460d423](https://github.com/karma-runner/karma/commit/460d423))



<a name="1.6.0"></a>
# [1.6.0](https://github.com/karma-runner/karma/compare/v1.5.0...v1.6.0) (2017-04-05)

Expand Down
6 changes: 2 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ version: "{build}"

environment:
matrix:
- nodejs_version: "0.12"
- nodejs_version: "4"
- nodejs_version: "5"
- nodejs_version: "6"
- nodejs_version: "7"
- nodejs_version: "8"

matrix:
fast_finish: true
Expand All @@ -23,7 +21,7 @@ install:
- npm --version

# Install our package dependencies
- npm install
- appveyor-retry npm install

# Install our current directory as a dependency of itself
- npm run init:windows
Expand Down
37 changes: 32 additions & 5 deletions client/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,42 @@ var Karma = function (socket, iframe, opener, navigator, location) {
navigateContextTo('about:blank')
}

function getLocation (url, lineno, colno) {
var location = ''

if (url !== undefined) {
location += url
}

if (lineno !== undefined) {
location += ':' + lineno
}

if (colno !== undefined) {
location += ':' + colno
}

return location
}

// error during js file loading (most likely syntax error)
// we are not going to execute at all
this.error = function (msg, url, line) {
var message = msg
// we are not going to execute at all. `window.onerror` callback.
this.error = function (messageOrEvent, source, lineno, colno, error) {
var message = messageOrEvent
var location = getLocation(source, lineno, colno)

if (url) {
message = msg + '\nat ' + url + (line ? ':' + line : '')
if (location !== '') {
message += '\nat ' + location
}

if (error) {
message += '\n\n' + error.stack
}

// create an object with the string representation of the message to ensure all its content is properly
// transferred to the console log
message = {message: message, str: message.toString()}

socket.emit('karma_error', message)
this.complete()
return false
Expand Down
2 changes: 1 addition & 1 deletion config.tpl.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (config) ->
]


# list of files to exclude
# list of files / patterns to exclude
exclude: [%EXCLUDE%
]

Expand Down
2 changes: 1 addition & 1 deletion config.tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function(config) {
],


// list of files to exclude
// list of files / patterns to exclude
exclude: [%EXCLUDE%
],

Expand Down
2 changes: 1 addition & 1 deletion config.tpl.ls
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (config) ->
]


# list of files to exclude
# list of files / patterns to exclude
exclude: [%EXCLUDE%
]

Expand Down
2 changes: 1 addition & 1 deletion config.tpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (config) => {
],


// list of files to exclude
// list of files / patterns to exclude
exclude: [%EXCLUDE%
],

Expand Down
7 changes: 5 additions & 2 deletions docs/config/01-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ These are all of the available configuration options.

**Description:** When Karma is watching the files for changes, it tries to batch
multiple changes into a single run so that the test runner doesn't try to start and restart running
tests more than it should. The configuration setting tells Karma how long to wait (in milliseconds) after any changes
have occurred before starting the test process again.
tests more than it should, or restart while build files are not in a consistent state. The configuration setting
tells Karma how long to wait (in milliseconds) from the last file change before starting
the test process again, resetting the timer each time a file changes (i.e. [debouncing](https://davidwalsh.name/javascript-debounce-function)).


## basePath
Expand Down Expand Up @@ -521,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
Expand Down
11 changes: 11 additions & 0 deletions docs/config/02-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ Each pattern is either a simple string or an object with four properties:
* **No Default.**
* **Description.** The pattern to use for matching. This property is mandatory.

### `type`
* **Type.** String
* **Default.** Will attempt to determine type based on file extension. If that fails, defaults to `js`.
* **Description.** Choose the type to use when including a file.
* **Possible Values:**
* `css`
* `html`
* `js`
* `dart`
* `module`

### `watched`
* **Type.** Boolean
* **Default.** `true`
Expand Down
1 change: 1 addition & 0 deletions docs/dev/02-making-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ TODO:

If you are thinking about making Karma better, or you just want to hack on it, that’s great!
Here are some tips on how to set up a Karma workspace and how to send a good pull request.
**Please note we enforce [commit message conventions].**

## Setting up the Workspace

Expand Down
2 changes: 1 addition & 1 deletion docs/intro/01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Karma runs on [Node.js] and is available as an [NPM] package.
On Mac or Linux we recommend using [NVM](https://github.com/creationix/nvm). On Windows, download Node.js
from [the official site](https://nodejs.org/) or use the [NVM PowerShell Module](https://www.powershellgallery.com/packages/nvm).

Note: Karma currently works on Node.js **0.10**, **0.12.x**, **4.x**, **5.x**, **6.x**, and **7.x**. See [FAQ] for more info.
Note: Karma currently works on Node.js **4.x**, **5.x**, **6.x**, **7.x**, and **8.x**. See [FAQ] for more info.

## Installing Karma and plugins

Expand Down
2 changes: 1 addition & 1 deletion docs/intro/04-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The latest stable version from NPM (`npm install karma`). See [versioning] for m


### Which version of Node.js does Karma run with?
Karma works on all LTS versions node in active maintenance state (see [LTS docs](https://github.com/nodejs/LTS/blob/master/README.md) for more info) as well as the latest stable version. That is **0.12.x**, **4.x**, **5.x** and **6.x** at this point. Additionally, Node **0.10** is currently supported.
Karma works on all LTS versions node in active maintenance state (see [LTS docs](https://github.com/nodejs/LTS/blob/master/README.md) for more info) as well as the latest stable version. That is **4.x**, **5.x**, **6.x**, and **8.x** at this point.


[mailing list]: https://groups.google.com/d/forum/karma-users
Expand Down
10 changes: 5 additions & 5 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module.exports = function (grunt) {
},
mochaTest: {
options: {
require: 'babel-register',
reporter: 'dot',
ui: 'bdd',
quiet: false,
Expand All @@ -46,9 +45,9 @@ module.exports = function (grunt) {
},
cucumberjs: {
options: {
steps: 'test/e2e/steps',
steps: 'test/e2e/step_definitions',
format: 'progress',
require: 'test/e2e/support/env.js'
require: ['test/e2e/support/env.js', 'test/e2e/support/world.js']
},
all: 'test/e2e/*.feature',
current: {
Expand All @@ -64,7 +63,7 @@ module.exports = function (grunt) {
src: 'test/e2e/*.feature'
},
options: {
tags: '~@not-jenkins'
tags: 'not @not-jenkins'
}
}
},
Expand Down Expand Up @@ -135,8 +134,9 @@ module.exports = function (grunt) {
grunt.loadTasks('tasks')
require('load-grunt-tasks')(grunt)

grunt.registerTask('lint', ['eslint'])
grunt.registerTask('build', ['browserify:client'])
grunt.registerTask('default', ['build', 'test', 'lint'])
grunt.registerTask('default', ['build', 'lint', 'test'])
grunt.registerTask('test-appveyor', ['test:unit', 'test:client'])

grunt.registerTask('release', 'Build, bump and publish to NPM.', function (type) {
Expand Down
3 changes: 3 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ var processArgs = function (argv, options, fs, path) {
Object.getOwnPropertyNames(argv).forEach(function (name) {
var argumentValue = argv[name]
if (name !== '_' && name !== '$0') {
if (name.indexOf('_') !== -1) {
throw new Error('Bad argument: ' + name + ' did you mean ' + name.replace('_', '-'))
}
if (Array.isArray(argumentValue)) {
// If the same argument is defined multiple times, override.
argumentValue = argumentValue.pop()
Expand Down
24 changes: 18 additions & 6 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ try {
COFFEE_SCRIPT_AVAILABLE = true
} catch (e) {}

// CoffeeScript lost the hyphen in the module name a long time ago, all new version are named this:
try {
require('coffeescript').register()
COFFEE_SCRIPT_AVAILABLE = true
} catch (e) {}

// LiveScript is required here to enable config files written in LiveScript.
// It's not directly used in this file.
try {
Expand All @@ -30,13 +36,14 @@ try {
TYPE_SCRIPT_AVAILABLE = true
} catch (e) {}

var Pattern = function (pattern, served, included, watched, nocache) {
var Pattern = function (pattern, served, included, watched, nocache, type) {
this.pattern = pattern
this.served = helper.isDefined(served) ? served : true
this.included = helper.isDefined(included) ? included : true
this.watched = helper.isDefined(watched) ? watched : true
this.nocache = helper.isDefined(nocache) ? nocache : false
this.weight = helper.mmPatternWeight(pattern)
this.type = type
}

Pattern.prototype.compare = function (other) {
Expand All @@ -61,7 +68,8 @@ var createPatternObject = function (pattern) {
pattern.served,
pattern.included,
pattern.watched,
pattern.nocache)
pattern.nocache,
pattern.type)
}

log.warn('Invalid pattern %s!\n\tObject is missing "pattern" property.', pattern)
Expand Down Expand Up @@ -284,7 +292,7 @@ var Config = function () {
this.LOG_DEBUG = constant.LOG_DEBUG

this.set = function (newConfig) {
_.merge(config, newConfig, function (obj, src) {
_.mergeWith(config, newConfig, function (obj, src) {
// Overwrite arrays to keep consistent with #283
if (_.isArray(src)) {
return src
Expand Down Expand Up @@ -315,7 +323,7 @@ var Config = function () {
this.autoWatch = true
this.autoWatchBatchDelay = 250
this.restartOnFileChange = false
this.usePolling = process.platform === 'darwin' || process.platform === 'linux'
this.usePolling = process.platform === 'linux'
this.reporters = ['progress']
this.singleRun = false
this.browsers = []
Expand Down Expand Up @@ -357,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)
Expand Down Expand Up @@ -389,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 () {}
}
Expand Down Expand Up @@ -433,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)
}

Expand Down
Loading