mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(napi/transform): fix test
This commit is contained in:
parent
59abf27d95
commit
ea7a52f1b4
2 changed files with 7 additions and 7 deletions
2
napi/transform/index.d.ts
vendored
2
napi/transform/index.d.ts
vendored
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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"],
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue