diff --git a/__test__/export-declaration.test.ts b/__test__/export-declaration.test.ts index 37255a2..a83dd03 100644 --- a/__test__/export-declaration.test.ts +++ b/__test__/export-declaration.test.ts @@ -109,13 +109,19 @@ const TEST_TABLE = [ // ts doesn't allow this // in swc js, need to turn on this by -test.skip('export x from "a"', () => { - try { - const json = parseCode(`export x from "a"`); - } catch (e) { - console.log(e); - fail(e); - } +test('export x from "a"', () => { + const imps = parseCode(`export x from "a"`, 'x.js'); + expect(imps).toEqual( + [{ + "type": "ExportNamedDeclaration", + "specifiers": [{"exported": "x", "type": "ExportDefaultSpecifier"}], + "exportKind": "value", + "source": "a", + "start": expect.any(Number), + "end": expect.any(Number), + }] + ) + }) test.skip('export type * from "a"', () => { diff --git a/__test__/performance.test.ts b/__test__/performance.test.ts index c6df88d..5054167 100644 --- a/__test__/performance.test.ts +++ b/__test__/performance.test.ts @@ -2,16 +2,16 @@ import {readFileSync} from 'fs' import {join} from "path"; +// @ts-ignore import {parseFiles, parseFilesJsonStr} from "../index"; let files: string[] = []; try { - files = readFileSync(join(__dirname, 'list.txt'), 'utf-8').trim().split('\n'); + files = readFileSync(join(__dirname, 'list.txt'), 'utf-8').trim().split('\n') } catch (e) { } - if (files.length === 0) { console.error('if you want to run performance test, put files list in __test__/list.txt') console.error('a file path per line') @@ -23,7 +23,7 @@ if (files.length === 0) { const duration = Date.now() - start; console.log( - `[JSON] parse ${files.length} files, cost ${duration}ms, average ${duration / files.length}ms per file` + `[JSONString] parse ${files.length} files, cost ${duration}ms, average ${duration / files.length}ms per file` ) }) @@ -33,10 +33,10 @@ if (files.length === 0) { const duration = Date.now() - start; console.log( - `[Object] parse ${files.length} files, cost ${duration}ms, average ${duration / files.length}ms per file` + `[ Object ] parse ${files.length} files, cost ${duration}ms, average ${duration / files.length}ms per file` ) }) } -it.skip('bypass jest error', () => { +it('bypass jest error', () => { }); \ No newline at end of file