Skip to content

Commit

Permalink
test: fix error, environment difference
Browse files Browse the repository at this point in the history
- `TextEncoder/TextDecoder` is a Node API
- `Uint8Array` is a jsdom API

vitest-dev/vitest#4043
  • Loading branch information
deot committed Sep 5, 2023
1 parent 4b03f92 commit fb08960
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/builder/__tests__/index.spec.ts
Expand Up @@ -3,6 +3,7 @@ import * as fs from 'node:fs';
import { Locals, Shell } from '@deot/dev-shared';
import * as Builder from '@deot/dev-builder';

// @vitest-environment node
describe('index', () => {
it('config', () => {
const it = Locals.impl();
Expand Down
14 changes: 9 additions & 5 deletions packages/dever/__tests__/index.spec.ts
Expand Up @@ -4,6 +4,7 @@ import { Locals, Shell } from '@deot/dev-shared';
import * as Dever from '@deot/dev-dever';
import { Launch } from '@deot/dev-test';

// @vitest-environment node
describe('index', () => {
it('config', () => {
const it = Locals.impl();
Expand Down Expand Up @@ -39,13 +40,16 @@ describe('index', () => {
subprocess.stdout.on('data', (data) => {
data = data.toString().replace(/(\t|\n|\v|\r|\f|\s)/g, '');
if (!data) return;

data.split('>').forEach((url: string) => {
data.split('>').filter(i => !!i).forEach((url: string) => {
url = url.match(/(.*)(http:.*)/)?.[2] || '';
if (url && expects.some(i => url.includes(i))) {
task = task
.then(() => ctx.page.goto(url))
.then(() => ctx.operater.html("#test"))
.then(() => {
return ctx.page.goto(url);
})
.then(() => {
return ctx.operater.html("#test");
})
.then((res) => {
expect(res).toMatch('Hello World!');
expects = expects.filter(i => !url.includes(i));
Expand All @@ -58,5 +62,5 @@ describe('index', () => {
});
});
});
}, 120000);
}, 60000);
});

0 comments on commit fb08960

Please sign in to comment.