Skip to content

Commit 6bf3f97

Browse files
authored
test: Make tests resilient between versions: no more annoying chores (#1045)
1 parent 3a6aba8 commit 6bf3f97

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

__tests__/__snapshots__/bin.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`--config 1`] = `
55
<html>
66
<head>
77
<meta charset='utf-8' />
8-
<title>documentation 6.0.0 | Documentation</title>
8+
<title> | Documentation</title>
99
<meta name='viewport' content='width=device-width,initial-scale=1'>
1010
<link href='assets/bass.css' type='text/css' rel='stylesheet' />
1111
<link href='assets/style.css' type='text/css' rel='stylesheet' />
@@ -17,7 +17,7 @@ exports[`--config 1`] = `
1717
<div id='split-left' class='overflow-auto fs0 height-viewport-100'>
1818
<div class='py1 px2'>
1919
<h3 class='mb0 no-anchor'>documentation</h3>
20-
<div class='mb1'><code>6.0.0</code></div>
20+
<div class='mb1'><code>6.1.0</code></div>
2121
<input
2222
placeholder='Filter'
2323
id='filter-input'

__tests__/__snapshots__/test.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ exports[`html nested.input.js 1`] = `
827827
<html>
828828
<head>
829829
<meta charset='utf-8' />
830-
<title>documentation 6.0.0 | Documentation</title>
830+
<title> | Documentation</title>
831831
<meta name='viewport' content='width=device-width,initial-scale=1'>
832832
<link href='assets/bass.css' type='text/css' rel='stylesheet' />
833833
<link href='assets/style.css' type='text/css' rel='stylesheet' />
@@ -839,7 +839,7 @@ exports[`html nested.input.js 1`] = `
839839
<div id='split-left' class='overflow-auto fs0 height-viewport-100'>
840840
<div class='py1 px2'>
841841
<h3 class='mb0 no-anchor'>documentation</h3>
842-
<div class='mb1'><code>6.0.0</code></div>
842+
<div class='mb1'><code>6.1.0</code></div>
843843
<input
844844
placeholder='Filter'
845845
id='filter-input'

__tests__/bin.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ test('--config', async function() {
171171
{},
172172
false
173173
);
174-
const output = fs.readFileSync(outputIndex, 'utf8');
174+
let output = fs.readFileSync(outputIndex, 'utf8');
175+
output = output.replace(/documentation \d+\.\d+\.\d+/g, '');
175176
expect(output).toMatchSnapshot();
176177
});
177178

__tests__/test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ describe('html', function() {
103103
const clean = html
104104
.sort((a, b) => a.path > b.path)
105105
.filter(r => r.path.match(/(html)$/))
106-
.map(r => r.contents)
106+
.map(r =>
107+
r.contents.toString().replace(/documentation \d+\.\d+\.\d+/g, '')
108+
)
107109
.join('\n');
108110
expect(clean).toMatchSnapshot();
109111
});

0 commit comments

Comments
 (0)