Skip to content

Commit faec008

Browse files
committed
test(formatter): Fix tests using TS syntax with .js
1 parent 381e08c commit faec008

File tree

6 files changed

+96
-130
lines changed

6 files changed

+96
-130
lines changed

crates/oxc_formatter/tests/fixtures/js/comments/assignments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const jestPackageJson =
1515
class A {
1616
#testerConfig;
1717
constructor() {
18-
let basePath: string | undefined =
18+
let basePath =
1919
this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir;
2020
}
2121
}

crates/oxc_formatter/tests/fixtures/js/comments/assignments.js.snap

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,33 @@ const jestPackageJson =
1919
class A {
2020
#testerConfig;
2121
constructor() {
22-
let basePath: string | undefined =
22+
let basePath =
2323
this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir;
2424
}
2525
}
2626

2727
==================== Output ====================
28+
var longlonglonglonglonglong =
29+
/*#__PURE__*/ _interopDefaultLegacy(aaaaaaaaaaaaaaa);
30+
var short = /*#__PURE__*/ _interopDefaultLegacy(b);
31+
32+
const jestPackageJson =
33+
// eslint-disable-next-line @typescript-eslint/no-require-imports
34+
require(jestPath);
35+
36+
{
37+
sourcemap =
38+
/** @type {'inline' | 'hidden' | 'sourcemap'} */ (
39+
process.env.WORKER_MODE
40+
) || sourcemap;
41+
}
42+
43+
class A {
44+
#testerConfig;
45+
constructor() {
46+
let basePath =
47+
this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir;
48+
}
49+
}
2850

2951
===================== End =====================

crates/oxc_formatter/tests/fixtures/js/comments/yield.js

Lines changed: 0 additions & 60 deletions
This file was deleted.

crates/oxc_formatter/tests/fixtures/js/comments/yield.js.snap

Lines changed: 0 additions & 68 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var longlonglonglonglonglong = /*#__PURE__*/_interopDefaultLegacy(aaaaaaaaaaaaaaa);
2+
var short = /*#__PURE__*/_interopDefaultLegacy(b);
3+
4+
const jestPackageJson =
5+
// eslint-disable-next-line @typescript-eslint/no-require-imports
6+
require(jestPath);
7+
8+
{
9+
sourcemap =
10+
/** @type {'inline' | 'hidden' | 'sourcemap'} */ (
11+
process.env.WORKER_MODE
12+
) || sourcemap;
13+
}
14+
15+
class A {
16+
#testerConfig;
17+
constructor() {
18+
let basePath: string | undefined =
19+
this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir;
20+
}
21+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
source: crates/oxc_formatter/tests/fixtures/mod.rs
3+
---
4+
==================== Input ====================
5+
var longlonglonglonglonglong = /*#__PURE__*/_interopDefaultLegacy(aaaaaaaaaaaaaaa);
6+
var short = /*#__PURE__*/_interopDefaultLegacy(b);
7+
8+
const jestPackageJson =
9+
// eslint-disable-next-line @typescript-eslint/no-require-imports
10+
require(jestPath);
11+
12+
{
13+
sourcemap =
14+
/** @type {'inline' | 'hidden' | 'sourcemap'} */ (
15+
process.env.WORKER_MODE
16+
) || sourcemap;
17+
}
18+
19+
class A {
20+
#testerConfig;
21+
constructor() {
22+
let basePath: string | undefined =
23+
this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir;
24+
}
25+
}
26+
27+
==================== Output ====================
28+
var longlonglonglonglonglong =
29+
/*#__PURE__*/ _interopDefaultLegacy(aaaaaaaaaaaaaaa);
30+
var short = /*#__PURE__*/ _interopDefaultLegacy(b);
31+
32+
const jestPackageJson =
33+
// eslint-disable-next-line @typescript-eslint/no-require-imports
34+
require(jestPath);
35+
36+
{
37+
sourcemap =
38+
/** @type {'inline' | 'hidden' | 'sourcemap'} */ (
39+
process.env.WORKER_MODE
40+
) || sourcemap;
41+
}
42+
43+
class A {
44+
#testerConfig;
45+
constructor() {
46+
let basePath: string | undefined =
47+
this.#testerConfig.languageOptions.parserOptions?.tsconfigRootDir;
48+
}
49+
}
50+
51+
===================== End =====================

0 commit comments

Comments
 (0)