You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/01-writing-tests.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -267,14 +267,19 @@ test('context is unicorn', t => {
267
267
});
268
268
```
269
269
270
-
## Retrieving test meta data
270
+
## Retrieving test metadata
271
271
272
-
Helper files can determine the filename of the test being run by reading `test.meta.file`. This eliminates the need to pass `__filename` from the test to helpers.
272
+
Access data about the currently loaded test file run by reading `test.meta`.
273
+
274
+
Available properties:
275
+
276
+
*`file`: path to the test file
277
+
*`snapshotDirectory`: directory where snapshots are stored
273
278
274
279
```js
275
280
consttest=require('ava');
276
281
277
-
console.log('Test currently being run:', test.meta.file);
282
+
console.log('Test file currently being run:', test.meta.file);
0 commit comments