-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove snapshot files when a test file stops using snapshots
Fixes #1424. Co-authored-by: Mark Wubben <mark@novemberborn.net>
- Loading branch information
1 parent
98595da
commit 4f093ab
Showing
36 changed files
with
710 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const test = require('../../../..'); | ||
|
||
if (process.env.TEMPLATE) { | ||
test('test title', t => { | ||
t.snapshot({foo: 'bar'}); | ||
t.snapshot({answer: 42}); | ||
t.pass(); | ||
}); | ||
|
||
test('another test', t => { | ||
t.snapshot(new Map()); | ||
}); | ||
} else { | ||
test('test title', t => { | ||
t.pass(); | ||
}); | ||
|
||
test('another test', t => { | ||
t.pass(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
test/snapshot-removal/fixtures/fixed-snapshot-dir/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"ava": { | ||
"snapshotDir": "fixedSnapshotDir" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const test = require(process.env.AVA_PATH); // This fixture is copied to a temporary directory, so require AVA through its configured path. | ||
|
||
if (process.env.TEMPLATE) { | ||
test('some snapshots', t => { | ||
t.snapshot('foo'); | ||
t.snapshot('bar'); | ||
t.pass(); | ||
}); | ||
|
||
test('another snapshot', t => { | ||
t.snapshot('baz'); | ||
t.pass(); | ||
}); | ||
} else { | ||
test('some snapshots', t => { | ||
t.pass(); | ||
}); | ||
|
||
test('another snapshot', t => { | ||
t.pass(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const test = require('ava'); | ||
|
||
test('without snapshots', t => { | ||
t.pass(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const test = require(process.env.AVA_PATH); // This fixture is copied to a temporary directory, so require AVA through its configured path. | ||
|
||
if (process.env.TEMPLATE) { | ||
test('some snapshots', t => { | ||
t.snapshot('foo'); | ||
t.snapshot('bar'); | ||
t.pass(); | ||
}); | ||
|
||
test('another snapshot', t => { | ||
t.snapshot('baz'); | ||
t.pass(); | ||
}); | ||
} else { | ||
test.only('some snapshots', t => { | ||
t.pass(); | ||
}); | ||
|
||
test('another snapshot', t => { | ||
t.pass(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const test = require(process.env.AVA_PATH); // This fixture is copied to a temporary directory, so require AVA through its configured path. | ||
|
||
if (process.env.TEMPLATE) { | ||
test('some snapshots', t => { | ||
t.snapshot('foo'); | ||
t.snapshot('bar'); | ||
t.pass(); | ||
}); | ||
|
||
test('another snapshot', t => { | ||
t.snapshot('baz'); | ||
t.pass(); | ||
}); | ||
} else { | ||
test('some snapshots', t => { | ||
t.pass(); | ||
}); | ||
|
||
test('another snapshot', t => { | ||
t.pass(); | ||
}); | ||
} |
1 change: 1 addition & 0 deletions
1
test/snapshot-removal/fixtures/skipped-snapshots-in-try/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
23 changes: 23 additions & 0 deletions
23
test/snapshot-removal/fixtures/skipped-snapshots-in-try/test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const test = require(process.env.AVA_PATH); // This fixture is copied to a temporary directory, so require AVA through its configured path. | ||
|
||
if (process.env.TEMPLATE) { | ||
test('skipped snapshots in try', async t => { | ||
const attempt = await t.try(tt => { | ||
tt.snapshot('in try'); | ||
}); | ||
|
||
attempt.commit(); | ||
|
||
t.pass(); | ||
}); | ||
} else { | ||
test('skipped snapshots in try', async t => { | ||
const attempt = await t.try(tt => { | ||
tt.snapshot.skip('in try'); | ||
}); | ||
|
||
attempt.discard(); | ||
|
||
t.pass(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const test = require(process.env.AVA_PATH); // This fixture is copied to a temporary directory, so require AVA through its configured path. | ||
|
||
if (process.env.TEMPLATE) { | ||
test('some snapshots', t => { | ||
t.snapshot('foo'); | ||
t.snapshot('bar'); | ||
t.pass(); | ||
}); | ||
|
||
test('another snapshot', t => { | ||
t.snapshot('baz'); | ||
t.pass(); | ||
}); | ||
} else { | ||
test('some snapshots', t => { | ||
t.snapshot.skip('foo'); | ||
t.pass(); | ||
}); | ||
|
||
test('another snapshot', t => { | ||
t.pass(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Oops, something went wrong.