Skip to content

Commit c7f63c4

Browse files
committed
Force not-ci in snapshot-order tests
When ava is run in CI, new snapshots cannot be written. In normal circumstances, this ensures that snapshot assertions don't get merged without a recorded snapshot; lacking this feature, CI could appear to pass when in fact snapshot assertions were not checked. In this case, however, writing snapshots is intended.
1 parent 244cdfc commit c7f63c4

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

test/snapshot-order/test.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ const path = require('path');
55

66
test('snapshot files are independent of test resolution order', async t => {
77
const options = {
8-
cwd: exec.cwd('intertest-order')
8+
cwd: exec.cwd('intertest-order'),
9+
env: {
10+
AVA_FORCE_CI: 'not-ci'
11+
}
912
};
1013
// Run, updating snapshots.
1114
await exec.fixture(['test.js', '--update-snapshots'], options);
@@ -16,10 +19,11 @@ test('snapshot files are independent of test resolution order', async t => {
1619

1720
// Run in reversed order, updating snapshots.
1821
await exec.fixture(['test.js', '--update-snapshots'], {
22+
...options,
1923
env: {
20-
INTERTEST_ORDER_REVERSE: 'true'
21-
},
22-
...options
24+
INTERTEST_ORDER_REVERSE: 'true',
25+
...options.env
26+
}
2327
});
2428

2529
// Read the resulting file
@@ -31,7 +35,10 @@ test('snapshot files are independent of test resolution order', async t => {
3135

3236
test('snapshot reports are sorted in declaration order', async t => {
3337
const options = {
34-
cwd: exec.cwd('report-declaration-order')
38+
cwd: exec.cwd('report-declaration-order'),
39+
env: {
40+
AVA_FORCE_CI: 'not-ci'
41+
}
3542
};
3643

3744
await exec.fixture(['--update-snapshots'], options);

0 commit comments

Comments
 (0)