Skip to content

Commit

Permalink
fix(napi/transform): fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Sep 3, 2024
1 parent 59abf27 commit ea7a52f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion napi/transform/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export interface TypeScriptBindingOptions {
* Rewrite or remove TypeScript import/export declaration extensions.
*
* - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
* - When set to `remove`, it will remove the extensions entirely.
* - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
* - When set to `true`, it's equivalent to `rewrite`.
* - When set to `false` or omitted, no changes will be made to the extensions.
*
Expand Down
12 changes: 6 additions & 6 deletions napi/transform/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import assert from "assert";
console.log(`Testing on ${process.platform}-${process.arch}`);

test(oxc.isolatedDeclaration("test.ts", "class A {}", { sourcemap: true }), {
sourceText: "declare class A {}\n",
sourceMap: {
code: "declare class A {}\n",
map: {
mappings: "AAAA,cAAM,EAAE,CAAE",
names: [],
sources: ["test.ts"],
Expand All @@ -14,12 +14,12 @@ test(oxc.isolatedDeclaration("test.ts", "class A {}", { sourcemap: true }), {
});

function test(ret, expected) {
console.log(ret.sourceText);
console.log(ret.sourceMap);
console.log(ret.code);
console.log(ret.map);
for (const error of ret.errors) {
console.log(error);
}
assert.equal(ret.sourceText, expected.sourceText);
assert.deepEqual(ret.sourceMap, expected.sourceMap);
assert.equal(ret.code, expected.code);
assert.deepEqual(ret.map, expected.map);
assert(ret.errors.length == 0);
}

0 comments on commit ea7a52f

Please sign in to comment.