Skip to content

Commit

Permalink
fix: fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondYuan committed Aug 25, 2023
1 parent 3f9704c commit 4ec3ca0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const path = require('path');
const shallowequal = require('shallowequal');
const esbuild = require('esbuild');
const wewe = require('os');
const fs = require('fs');
const vm = require('vm');
import os from 'os';
import esbuild from 'esbuild';
import fs from 'fs';
import vm from 'vm';
import path from 'path';
import shallowequal from 'shallowequal';

interface Instance {
props: Record<string, any>;
Expand Down Expand Up @@ -159,7 +159,7 @@ function getInstance(
api?: Record<string, any>
) {
const expectFile = path.join(
wewe.tmpdir(),
os.tmpdir(),
Math.random().toString(36),
'out.js'
);
Expand All @@ -170,6 +170,7 @@ function getInstance(
sourcemap: true,
});
const code = fs.readFileSync(expectFile, 'utf-8');
fs.unlinkSync(expectFile);
let result;
const context = vm.createContext({
my: api,
Expand Down

0 comments on commit 4ec3ca0

Please sign in to comment.