Skip to content

Commit

Permalink
Include a banner at the top of snapshot files encouraging good behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Nov 19, 2017
1 parent fb49333 commit 1e86c33
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/snapshot.js
Expand Up @@ -61,7 +61,13 @@ class Snapshot {
.replace(/\`/g, '\\\`')
.replace(/\$\{/g, '\\${')

const data = `'use strict'\n` + (
const data =
'/* IMPORTANT\n' +
' * This snapshot file is auto-generated, but designed for humans.\n' +
' * It should be checked into source control and tracked carefully.\n' +
' * Re-generate by setting TAP_SNAPSHOT=1 and running tests.\n' +
' * Make sure to inspect the output below. Do not ignore changes!\n' +
' */\n\'use strict\'\n' + (
Object.keys(this.snapshot).map(s =>
`exports[\`${
escape(s)
Expand Down
6 changes: 6 additions & 0 deletions tap-snapshots/test-run.js-TAP.test.js
@@ -1,3 +1,9 @@
/* IMPORTANT
* This snapshot file is auto-generated, but designed for humans.
* It should be checked into source control and tracked carefully.
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/run.js TAP basic > ok.js output 1`] = `
TAP version 13
Expand Down
6 changes: 6 additions & 0 deletions tap-snapshots/test-spawn.js-TAP.test.js
@@ -1,3 +1,9 @@
/* IMPORTANT
* This snapshot file is auto-generated, but designed for humans.
* It should be checked into source control and tracked carefully.
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/spawn.js TAP timeout KILL > undefined 1`] = `
SIGTERM
Expand Down
6 changes: 6 additions & 0 deletions tap-snapshots/test-tap.js-TAP.test.js
@@ -1,3 +1,9 @@
/* IMPORTANT
* This snapshot file is auto-generated, but designed for humans.
* It should be checked into source control and tracked carefully.
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/tap.js TAP ok > exit status 1`] = `
{ code: 0, signal: null }
Expand Down
6 changes: 6 additions & 0 deletions tap-snapshots/test-test.js-TAP.test.js
@@ -1,3 +1,9 @@
/* IMPORTANT
* This snapshot file is auto-generated, but designed for humans.
* It should be checked into source control and tracked carefully.
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/test.js TAP short output checks no plan no options > no plan 1`] = `
TAP version 13
Expand Down

0 comments on commit 1e86c33

Please sign in to comment.