Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored and Boshen committed Nov 22, 2024
1 parent ed0efe5 commit 7757ae8
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions napi/transform/test/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,30 @@ describe('transform', () => {
});

describe('target', () => {
const data = [
["es2015", "a ** b;\n"],
["es2016", "async function foo() {}\n"],
["es2017", "({ ...x });\n"],
["es2017", "try {} catch {}\n"],
["es2019", "a?.b;\n"],
["es2019", "a ?? b;\n"],
["es2021", "class foo {\n\tstatic {}\n}\n"],
];

test.each(data)('transform %s', (target, code) => {
// Also test array syntax.
const ret = oxc.transform('test.js', code, { target: [target] });
assert(ret.errors.length == 0);
assert(ret.code);
assert.notEqual(ret.code, code);
});
const data = [
['es2015', 'a ** b;\n'],
['es2016', 'async function foo() {}\n'],
['es2017', '({ ...x });\n'],
['es2017', 'try {} catch {}\n'],
['es2019', 'a?.b;\n'],
['es2019', 'a ?? b;\n'],
['es2021', 'class foo {\n\tstatic {}\n}\n'],
];

test.each(data)('transform %s', (target, code) => {
// Also test array syntax.
const ret = oxc.transform('test.js', code, { target: [target] });
assert(ret.errors.length == 0);
assert(ret.code);
assert.notEqual(ret.code, code);
});

test.each(data)('no transform esnext', (_target, code) => {
const ret = oxc.transform('test.js', code, { target: 'esnext' });
assert(ret.errors.length == 0);
assert(ret.code);
assert.equal(ret.code, code);
});
test.each(data)('no transform esnext', (_target, code) => {
const ret = oxc.transform('test.js', code, { target: 'esnext' });
assert(ret.errors.length == 0);
assert(ret.code);
assert.equal(ret.code, code);
});
});

describe('modules', () => {
Expand Down

0 comments on commit 7757ae8

Please sign in to comment.