Skip to content

Commit

Permalink
test(napi/transform): add test for not default es transform
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Nov 9, 2024
1 parent eea4ab8 commit be819dd
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion napi/transform/test/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { assert, describe, it } from 'vitest';

import oxc from './index';

describe('transform', () => {
describe('simple', () => {
const code = 'export class A<T> {}';

it('matches output', () => {
Expand Down Expand Up @@ -31,6 +31,25 @@ describe('transform', () => {
});
});

describe('transform', () => {
it('should not transform by default', () => {
const cases = [
'() => {};',
'a ** b;',
'async function foo() {}',
'({ ...x });',
'try {} catch {}',
'a ?? b;',
'a ||= b;',
'class foo {\n\tstatic {}\n}',
];
for (const code of cases) {
const ret = oxc.transform('test.ts', code);
assert.equal(ret.code.trim(), code);
}
});
});

describe('modules', () => {
it('should transform export = and import ', () => {
const code = `
Expand Down

0 comments on commit be819dd

Please sign in to comment.