Skip to content

Commit 9cdc29b

Browse files
TheDancingCodenovemberborn
authored andcommitted
Print links to version-specific documentation
1 parent b6a95b1 commit 9cdc29b

File tree

8 files changed

+15
-10
lines changed

8 files changed

+15
-10
lines changed

lib/babel-pipeline.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const isPlainObject = require('is-plain-object');
88
const md5Hex = require('md5-hex');
99
const packageHash = require('package-hash');
1010
const stripBomBuf = require('strip-bom-buf');
11+
const pkg = require('../package.json');
1112
const chalk = require('./chalk').get();
1213

1314
function getSourceMap(filePath, code) {
@@ -46,7 +47,7 @@ function validate(conf) {
4647
(conf.testOptions !== undefined && !isPlainObject(conf.testOptions)) ||
4748
(conf.extensions !== undefined && !isValidExtensions(conf.extensions))
4849
) {
49-
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.`);
50+
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.`);
5051
}
5152

5253
return {

lib/reporters/improper-usage-messages.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22
const chalk = require('../chalk').get();
3+
const pkg = require('../../package.json');
34

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

2021
if (assertion === 'snapshot') {

test/cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const touch = require('touch');
1010
const uniqueTempDir = require('unique-temp-dir');
1111
const execa = require('execa');
1212
const stripAnsi = require('strip-ansi');
13+
const pkg = require('../package.json');
1314

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

@@ -79,7 +80,7 @@ for (const which of [
7980

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

8586
t.is(stderr, expectedOutput);

test/helper/report.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const path = require('path');
55
const globby = require('globby');
66
const proxyquire = require('proxyquire');
77
const replaceString = require('replace-string');
8+
const pkg = require('../../package.json');
89

910
let _Api = null;
1011
const createApi = options => {
@@ -72,7 +73,8 @@ exports.sanitizers = {
7273
return str;
7374
}
7475
return str === 'stdout\n' || str === 'stderr\n' ? '' : str;
75-
}
76+
},
77+
version: str => replaceString(str, `v${pkg.version}`, 'v1.0.0-beta.5.1')
7678
};
7779

7880
const run = (type, reporter) => {

test/reporters/mini.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const run = type => t => {
1515

1616
const tty = new TTYStream({
1717
columns: 200,
18-
sanitizers: [report.sanitizers.cwd, report.sanitizers.posix, report.sanitizers.unreliableProcessIO]
18+
sanitizers: [report.sanitizers.cwd, report.sanitizers.posix, report.sanitizers.unreliableProcessIO, report.sanitizers.version]
1919
});
2020
const reporter = new MiniReporter({
2121
spinner: {

test/reporters/mini.regular.log

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ stderr
207207

208208
Visit the following URL for more details:
209209

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

212212
fn (test.js:35:9)
213213
t (test.js:37:11)
@@ -236,7 +236,7 @@ stderr
236236

237237
Visit the following URL for more details:
238238

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

241241
fn (test.js:42:9)
242242
t (test.js:44:14)

test/reporters/verbose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const run = type => t => {
1515

1616
const tty = new TTYStream({
1717
columns: 200,
18-
sanitizers: [report.sanitizers.cwd, report.sanitizers.posix, report.sanitizers.slow, report.sanitizers.unreliableProcessIO]
18+
sanitizers: [report.sanitizers.cwd, report.sanitizers.posix, report.sanitizers.slow, report.sanitizers.unreliableProcessIO, report.sanitizers.version]
1919
});
2020
const reporter = new VerboseReporter({
2121
reportStream: tty,

test/reporters/verbose.regular.log

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ stderr
179179

180180
Visit the following URL for more details:
181181

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

184184
fn (test.js:35:9)
185185
t (test.js:37:11)
@@ -208,7 +208,7 @@ stderr
208208

209209
Visit the following URL for more details:
210210

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

213213
fn (test.js:42:9)
214214
t (test.js:44:14)

0 commit comments

Comments
 (0)