Skip to content

Commit

Permalink
fix(run): import core uvu within handler;
Browse files Browse the repository at this point in the history
- ensures `uvu` initializes with shared ENV/global context
  • Loading branch information
lukeed committed Jul 3, 2022
1 parent 213efb5 commit f735f5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions run/index.js
@@ -1,13 +1,12 @@
const { exec } = require('uvu');

exports.run = async function (suites, opts={}) {
globalThis.UVU_DEFER = 1;
const uvu = require('uvu');

suites.forEach((suite, idx) => {
globalThis.UVU_QUEUE.push([suite.name]);
globalThis.UVU_INDEX = idx;
require(suite.file);
});

await exec(opts.bail);
await uvu.exec(opts.bail);
}
7 changes: 3 additions & 4 deletions run/index.mjs
@@ -1,14 +1,13 @@
import { exec } from 'uvu';

export async function run(suites, opts={}) {
let suite, idx=0;
globalThis.UVU_DEFER = 1;
const uvu = await import('uvu');

let suite, idx=0;
for (suite of suites) {
globalThis.UVU_INDEX = idx++;
globalThis.UVU_QUEUE.push([suite.name]);
await import('file:///' + suite.file);
}

await exec(opts.bail);
await uvu.exec(opts.bail);
}

0 comments on commit f735f5a

Please sign in to comment.