Permalink
Browse files

Drop support for Node.js 0.10 and 0.12

Not complete, but a good start. I didn't want to cause conflicts with the open active PRs or work on the new test failure output.
  • Loading branch information...
1 parent 8440982 commit 8530fcdf304eed0e23b7915633f3a15fd1a4e65a @sindresorhus sindresorhus committed Nov 22, 2016
Showing with 2,100 additions and 2,277 deletions.
  1. +3 −4 .travis.yml
  2. +1 −2 appveyor.yml
  3. +42 −55 bench/compare.js
  4. +3 −3 bench/concurrent/alternating-sync-async.js
  5. +2 −2 bench/concurrent/async-immediate.js
  6. +2 −2 bench/concurrent/async-timeout.js
  7. +2 −2 bench/concurrent/sync.js
  8. +2 −2 bench/other/failures.js
  9. +41 −36 bench/run.js
  10. +3 −3 bench/serial/alternating-sync-async.js
  11. +2 −2 bench/serial/async-immediate.js
  12. +2 −2 bench/serial/async-timeout.js
  13. +2 −2 bench/serial/sync.js
  14. +1 −1 index.js
  15. +29 −32 lib/assert.js
  16. +29 −31 lib/babel-config.js
  17. +11 −33 lib/beautify-stack.js
  18. +20 −21 lib/caching-precompiler.js
  19. +1 −1 lib/colors.js
  20. +8 −12 lib/concurrent.js
  21. +44 −55 lib/fork.js
  22. +3 −8 lib/globals.js
  23. +15 −20 lib/hook.js
  24. +18 −21 lib/main.js
  25. +6 −10 lib/prefix-title.js
  26. +26 −25 lib/process-adapter.js
  27. +18 −25 lib/run-status.js
  28. +8 −9 lib/sequence.js
  29. +3 −5 lib/serialize-error.js
  30. +21 −21 lib/test-worker.js
  31. +59 −63 lib/test.js
  32. +9 −9 lib/throws-helper.js
  33. +67 −88 lib/watcher.js
  34. +8 −8 package.json
  35. +44 −47 profile.js
  36. +0 −10 scripts/xo.js
  37. +3 −6 test/api.js
  38. +115 −120 test/assert.js
  39. +5 −5 test/ava-error.js
  40. +46 −54 test/babel-config.js
  41. +14 −13 test/beautify-stack.js
  42. +41 −52 test/caching-precompiler.js
  43. +114 −115 test/cli.js
  44. +70 −70 test/concurrent.js
  45. +38 −38 test/fork.js
  46. +9 −8 test/helper/compare-line-output.js
  47. +151 −151 test/hooks.js
  48. +43 −43 test/observable.js
  49. +20 −21 test/profile.js
  50. +88 −90 test/promise.js
  51. +29 −29 test/run-status.js
  52. +147 −160 test/runner.js
  53. +67 −67 test/sequence.js
  54. +55 −58 test/test-collection.js
  55. +168 −172 test/test.js
  56. +3 −3 test/visual/lorem-ipsum.js
  57. +13 −12 test/visual/print-lorem-ipsum.js
  58. +19 −18 test/visual/run-visual-tests.js
  59. +3 −3 test/visual/text-ends-at-terminal-width.js
  60. +284 −297 test/watcher.js
View
@@ -1,16 +1,15 @@
language: node_js
node_js:
+ - '7'
- '6'
- '4'
- - '0.12'
- - '0.10'
cache:
directories:
- $HOME/.npm
- node_modules
before_install:
- - 'node -e "process.exit(Number(process.version.match(/^v(\d+)/)[1])>=6?0:1)" || npm install -g npm@3.x-latest'
+ - 'npm install --global npm'
before_script:
- - npm prune
+ - 'npm prune'
after_success:
- '[ -z "$COVERALLS_REPO_TOKEN" ] && tap --coverage-report=text-lcov | ./node_modules/.bin/coveralls'
View
@@ -2,12 +2,11 @@ environment:
matrix:
- nodejs_version: '6'
- nodejs_version: '4'
- - nodejs_version: '0.12'
install:
- ps: Install-Product node $env:nodejs_version
- set CI=true
- set AVA_APPVEYOR=true
- - npm install -g npm@3.x-latest
+ - npm install --global npm
- set PATH=%APPDATA%\npm;%PATH%
- npm install
- npm prune
View
@@ -1,60 +1,48 @@
'use strict';
-
-var path = require('path');
-var fs = require('fs');
-var Table = require('cli-table2');
-var chalk = require('chalk');
-
-var files = fs.readdirSync(path.join(__dirname, '.results'))
- .map(function (file) {
- var result = JSON.parse(fs.readFileSync(path.join(__dirname, '.results', file), 'utf8'));
+const path = require('path');
+const fs = require('fs');
+const Table = require('cli-table2');
+const chalk = require('chalk');
+
+let files = fs.readdirSync(path.join(__dirname, '.results'))
+ .map(file => {
+ const result = JSON.parse(fs.readFileSync(path.join(__dirname, '.results', file), 'utf8'));
result['.file'] = path.basename(file, '.json');
return result;
})
// find the most recent benchmark runs
- .sort(function (fileA, fileB) {
- return fileB['.time'] - fileA['.time'];
- });
+ .sort((fileA, fileB) => fileB['.time'] - fileA['.time']);
function average(data) {
- var sum = data.reduce(function (sum, value) {
- return sum + value;
- }, 0);
-
- var avg = sum / data.length;
+ const sum = data.reduce((sum, value) => sum + value, 0);
+ const avg = sum / data.length;
return avg;
}
function standardDeviation(values) {
- var avg = average(values);
- var squareDiffs = values.map(function (value) {
- var diff = value - avg;
- var sqrDiff = diff * diff;
+ const avg = average(values);
+ const squareDiffs = values.map(value => {
+ const diff = value - avg;
+ const sqrDiff = diff * diff;
return sqrDiff;
});
- var avgSquareDiff = average(squareDiffs);
- var stdDev = Math.sqrt(avgSquareDiff);
+ const avgSquareDiff = average(squareDiffs);
+ const stdDev = Math.sqrt(avgSquareDiff);
return stdDev;
}
-// Only the 3 most recent runs
+// only the 3 most recent runs
files = files.slice(0, 3);
function prepStats(times) {
times = times
- .map(function (time) {
- return time.time;
- })
- .sort(function (timeA, timeB) {
- return timeA - timeB;
- });
+ .map(time => time.time)
+ .sort((timeA, timeB) => timeA - timeB);
// remove fastest and slowest
times = times.slice(1, times.length - 1);
- var sum = times.reduce(function (a, b) {
- return a + b;
- }, 0);
+ const sum = times.reduce((a, b) => a + b, 0);
return {
mean: Math.round((sum / times.length) * 1000) / 1000,
@@ -65,60 +53,59 @@ function prepStats(times) {
};
}
-var results = {};
-var fileNames = files.map(function (file) {
- return file['.file'];
-});
-var stats = ['mean', 'stdDev', 'median', 'min', 'max'];
+const results = {};
+const fileNames = files.map(file => file['.file']);
+const stats = ['mean', 'stdDev', 'median', 'min', 'max'];
-files.forEach(function (file) {
+files.forEach(file => {
Object.keys(file)
- .filter(function (key) {
- return !/^\./.test(key);
- })
- .forEach(function (key) {
+ .filter(key => !/^\./.test(key))
+ .forEach(key => {
results[key] = results[key] || {};
results[key][file['.file']] = prepStats(file[key]);
});
});
-var table = new Table();
+const table = new Table();
table.push(
- [''].concat(stats.map(function (stat) {
+ [''].concat(stats.map(stat => {
return {
content: stat,
colSpan: fileNames.length,
hAlign: 'center'
};
})),
- stats.reduce(function (arr) {
- return arr.concat(fileNames);
- }, ['args'])
+ stats.reduce(arr => arr.concat(fileNames), ['args'])
);
Object.keys(results)
- .forEach(function (key) {
- table.push(stats.reduce(function (arr, stat) {
- var min = Infinity;
- var max = -Infinity;
+ .forEach(key => {
+ table.push(stats.reduce((arr, stat) => {
+ let min = Infinity;
+ let max = -Infinity;
- var statGroup = fileNames.map(function (fileName) {
- var result = results[key][fileName];
+ const statGroup = fileNames.map(fileName => {
+ let result = results[key][fileName];
result = result && result[stat];
+
if (result) {
min = Math.min(min, result);
max = Math.max(max, result);
return result;
}
+
return '';
});
- return arr.concat(statGroup.map(function (stat) {
+
+ return arr.concat(statGroup.map(stat => {
if (stat === min) {
return chalk.green(stat);
}
+
if (stat === max) {
return chalk.red(stat);
}
+
return stat;
}));
}, [key]));
@@ -1,9 +1,9 @@
import test from '../../';
-for (var i = 0; i < 10000; i++) {
+for (let i = 0; i < 10000; i++) {
if (i % 2) {
- test('test' + i, () => new Promise(resolve => setImmediate(resolve)));
+ test(`test${i}`, () => new Promise(resolve => setImmediate(resolve)));
} else {
- test('test' + i, () => {});
+ test(`test${i}`, () => {});
}
}
@@ -1,5 +1,5 @@
import test from '../../';
-for (var i = 0; i < 10000; i++) {
- test('test' + i, () => new Promise(resolve => setImmediate(resolve)));
+for (let i = 0; i < 10000; i++) {
+ test(`test${i}`, () => new Promise(resolve => setImmediate(resolve)));
}
@@ -1,5 +1,5 @@
import test from '../../';
-for (var i = 0; i < 10000; i++) {
- test('test' + i, () => new Promise(resolve => setTimeout(resolve, 0)));
+for (let i = 0; i < 10000; i++) {
+ test(`test${i}`, () => new Promise(resolve => setTimeout(resolve, 0)));
}
@@ -1,5 +1,5 @@
import test from '../../';
-for (var i = 0; i < 10000; i++) {
- test('test' + i, () => {});
+for (let i = 0; i < 10000; i++) {
+ test(`test${i}`, () => {});
}
@@ -1,7 +1,7 @@
import test from '../../';
-for (var i = 0; i < 1000; i++) {
- test.serial('test' + i, t => {
+for (let i = 0; i < 1000; i++) {
+ test.serial(`test${i}`, t => {
t.is(Math.random(), Math.random());
});
}
View
@@ -1,36 +1,36 @@
'use strict';
-var childProcess = require('child_process');
-var path = require('path');
-var fs = require('fs');
-var arrify = require('arrify');
-var Promise = require('bluebird');
-var mkdirp = require('mkdirp');
-var branch = require('git-branch').sync(path.join(__dirname, '..'));
+const childProcess = require('child_process');
+const path = require('path');
+const fs = require('fs');
+const arrify = require('arrify');
+const Promise = require('bluebird');
+const mkdirp = require('mkdirp');
+const branch = require('git-branch').sync(path.join(__dirname, '..'));
-var cliPath = require.resolve('../cli');
+const cliPath = require.resolve('../cli');
function runTests(_args) {
- return new Promise(function (resolve) {
- var args = [cliPath]
- .concat(arrify(_args));
- var start = Date.now();
+ return new Promise(resolve => {
+ const args = [cliPath].concat(arrify(_args));
+ const start = Date.now();
+
childProcess.execFile(process.execPath, args, {
cwd: __dirname,
maxBuffer: 100000 * 200
- }, function (err, stdout, stderr) {
- var end = Date.now();
+ }, (err, stdout, stderr) => {
+ const end = Date.now();
resolve({
args: arrify(_args),
time: end - start,
- err: err,
- stdout: stdout,
- stderr: stderr
+ err,
+ stdout,
+ stderr
});
});
});
}
-var list;
+let list;
if (process.argv.length === 2) {
list = [
@@ -47,61 +47,66 @@ if (process.argv.length === 2) {
'concurrent/async-timeout.js',
'concurrent/sync.js',
['concurrent/*.js', 'serial/*.js']
- ].map(function (definition) {
+ ].map(definition => {
if (Array.isArray(definition) || typeof definition === 'string') {
definition = {
shouldFail: false,
args: definition
};
}
+
return definition;
});
} else {
list = [];
- var currentArgs = [];
- var shouldFail = false;
- process.argv.slice(2).forEach(function (arg) {
+ let currentArgs = [];
+ let shouldFail = false;
+
+ process.argv.slice(2).forEach(arg => {
if (arg === '--') {
list.push({
args: currentArgs,
- shouldFail: shouldFail
+ shouldFail
});
currentArgs = [];
shouldFail = false;
return;
}
+
if (arg === '--should-fail') {
shouldFail = true;
return;
}
+
currentArgs.push(arg);
});
+
if (currentArgs.length > 0) {
list.push({
args: currentArgs,
- shouldFail: shouldFail
+ shouldFail
});
}
}
-list.forEach(function (definition) {
+list.forEach(definition => {
definition.args = ['--verbose'].concat(definition.args);
});
-var combined = [];
-for (var i = 0; i < 11; i++) {
+let combined = [];
+for (let i = 0; i < 11; i++) {
combined = combined.concat(list);
}
-var results = {};
+const results = {};
-Promise.each(combined, function (definition) {
- var args = definition.args;
+Promise.each(combined, definition => {
+ const args = definition.args;
- return runTests(args).then(function (result) {
- var key = result.args.join(' ');
- var passedOrFaild = result.err ? 'failed' : 'passed';
- var seconds = result.time / 1000;
+ return runTests(args).then(result => {
+ const key = result.args.join(' ');
+ const passedOrFaild = result.err ? 'failed' : 'passed';
+ const seconds = result.time / 1000;
console.log('%s %s in %d seconds', key, passedOrFaild, seconds);
@@ -119,12 +124,12 @@ Promise.each(combined, function (definition) {
time: seconds
});
});
-}).then(function () {
+}).then(() => {
mkdirp.sync(path.join(__dirname, '.results'));
results['.time'] = Date.now();
fs.writeFileSync(
- path.join(__dirname, '.results', branch + '.json'),
+ path.join(__dirname, '.results', `${branch}.json`),
JSON.stringify(results, null, 4)
);
});
Oops, something went wrong.

0 comments on commit 8530fcd

Please sign in to comment.