Skip to content

Commit

Permalink
Print links to version-specific documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDancingCode authored and novemberborn committed Jun 12, 2018
1 parent b6a95b1 commit 9cdc29b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion lib/babel-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const isPlainObject = require('is-plain-object');
const md5Hex = require('md5-hex');
const packageHash = require('package-hash');
const stripBomBuf = require('strip-bom-buf');
const pkg = require('../package.json');
const chalk = require('./chalk').get();

function getSourceMap(filePath, code) {
Expand Down Expand Up @@ -46,7 +47,7 @@ function validate(conf) {
(conf.testOptions !== undefined && !isPlainObject(conf.testOptions)) ||
(conf.extensions !== undefined && !isValidExtensions(conf.extensions))
) {
throw new Error(`Unexpected Babel configuration for AVA. See ${chalk.underline('https://github.com/avajs/ava/blob/master/docs/recipes/babel.md')} for allowed values.`);
throw new Error(`Unexpected Babel configuration for AVA. See ${chalk.underline(`https://github.com/avajs/ava/blob/v${pkg.version}/docs/recipes/babel.md`)} for allowed values.`);
}

return {
Expand Down
3 changes: 2 additions & 1 deletion lib/reporters/improper-usage-messages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';
const chalk = require('../chalk').get();
const pkg = require('../../package.json');

exports.forError = error => {
if (!error.improperUsage) {
Expand All @@ -14,7 +15,7 @@ exports.forError = error => {
Visit the following URL for more details:
${chalk.blue.underline('https://github.com/avajs/ava#throwsfunctionpromise-error-message')}`;
${chalk.blue.underline(`https://github.com/avajs/ava/blob/v${pkg.version}/readme.md#throwsthrower-expected-message`)}`;
}

if (assertion === 'snapshot') {
Expand Down
3 changes: 2 additions & 1 deletion test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const touch = require('touch');
const uniqueTempDir = require('unique-temp-dir');
const execa = require('execa');
const stripAnsi = require('strip-ansi');
const pkg = require('../package.json');

const cliPath = path.join(__dirname, '../cli.js');

Expand Down Expand Up @@ -79,7 +80,7 @@ for (const which of [

let expectedOutput = '\n';
expectedOutput += figures.cross + ' Unexpected Babel configuration for AVA.';
expectedOutput += ' See https://github.com/avajs/ava/blob/master/docs/recipes/babel.md for allowed values.';
expectedOutput += ` See https://github.com/avajs/ava/blob/v${pkg.version}/docs/recipes/babel.md for allowed values.`;
expectedOutput += '\n';

t.is(stderr, expectedOutput);
Expand Down
4 changes: 3 additions & 1 deletion test/helper/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const path = require('path');
const globby = require('globby');
const proxyquire = require('proxyquire');
const replaceString = require('replace-string');
const pkg = require('../../package.json');

let _Api = null;
const createApi = options => {
Expand Down Expand Up @@ -72,7 +73,8 @@ exports.sanitizers = {
return str;
}
return str === 'stdout\n' || str === 'stderr\n' ? '' : str;
}
},
version: str => replaceString(str, `v${pkg.version}`, 'v1.0.0-beta.5.1')
};

const run = (type, reporter) => {
Expand Down
2 changes: 1 addition & 1 deletion test/reporters/mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const run = type => t => {

const tty = new TTYStream({
columns: 200,
sanitizers: [report.sanitizers.cwd, report.sanitizers.posix, report.sanitizers.unreliableProcessIO]
sanitizers: [report.sanitizers.cwd, report.sanitizers.posix, report.sanitizers.unreliableProcessIO, report.sanitizers.version]
});
const reporter = new MiniReporter({
spinner: {
Expand Down
4 changes: 2 additions & 2 deletions test/reporters/mini.regular.log
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ stderr

Visit the following URL for more details:

https://github.com/avajs/ava#throwsfunctionpromise-error-message
https://github.com/avajs/ava/blob/v1.0.0-beta.5.1/readme.md#throwsthrower-expected-message

fn (test.js:35:9)
t (test.js:37:11)
Expand Down Expand Up @@ -236,7 +236,7 @@ stderr

Visit the following URL for more details:

https://github.com/avajs/ava#throwsfunctionpromise-error-message
https://github.com/avajs/ava/blob/v1.0.0-beta.5.1/readme.md#throwsthrower-expected-message

fn (test.js:42:9)
t (test.js:44:14)
Expand Down
2 changes: 1 addition & 1 deletion test/reporters/verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const run = type => t => {

const tty = new TTYStream({
columns: 200,
sanitizers: [report.sanitizers.cwd, report.sanitizers.posix, report.sanitizers.slow, report.sanitizers.unreliableProcessIO]
sanitizers: [report.sanitizers.cwd, report.sanitizers.posix, report.sanitizers.slow, report.sanitizers.unreliableProcessIO, report.sanitizers.version]
});
const reporter = new VerboseReporter({
reportStream: tty,
Expand Down
4 changes: 2 additions & 2 deletions test/reporters/verbose.regular.log
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ stderr

Visit the following URL for more details:

https://github.com/avajs/ava#throwsfunctionpromise-error-message
https://github.com/avajs/ava/blob/v1.0.0-beta.5.1/readme.md#throwsthrower-expected-message

fn (test.js:35:9)
t (test.js:37:11)
Expand Down Expand Up @@ -208,7 +208,7 @@ stderr

Visit the following URL for more details:

https://github.com/avajs/ava#throwsfunctionpromise-error-message
https://github.com/avajs/ava/blob/v1.0.0-beta.5.1/readme.md#throwsthrower-expected-message

fn (test.js:42:9)
t (test.js:44:14)
Expand Down

0 comments on commit 9cdc29b

Please sign in to comment.