Skip to content

Commit

Permalink
fix: declare test.meta
Browse files Browse the repository at this point in the history
  • Loading branch information
arlac77 committed May 5, 2024
1 parent e41a540 commit 22e0779
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/browser/ava.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export default function test(body, ...args) {
return def;
}

test.meta = {};

test.failing = (...args) => {
test(...args).failing = true;
};
Expand Down
1 change: 1 addition & 0 deletions src/browser/runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ async function execHooks(hooks, t) {
}

async function runTest(parent, tm, test) {
test.meta.file = tm;
if (!test.skip && !test.todo) {
const t = testContext(test, parent);

Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/tests/first-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ test("test.resolv", t => {

test("test.kitchensink", t => {
t.log("1st. assertion is coming soon");
t.log('Test file currently being run:', test.meta.file);
t.is(1, 1);
t.not(1, 2);

Expand Down

0 comments on commit 22e0779

Please sign in to comment.