Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
,-[files/index.js:1:1]
1 | debugger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
,-[files/01.js:1:1]
1 | debugger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
,-[files/index.js:1:1]
1 | debugger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

! basic-custom-plugin(no-debugger): Unexpected Debugger Statement
,-[files/index.js:1:1]
1 | debugger;
Expand Down
1 change: 0 additions & 1 deletion apps/oxlint/test/fixtures/built_in_errors/output.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed
,-[files/index.js:1:1]
1 | debugger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x context-plugin(log-context): id: context-plugin/log-context
,-[files/1.js:1:1]
1 | let x;
Expand Down
1 change: 0 additions & 1 deletion apps/oxlint/test/fixtures/createOnce/output.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x create-once-plugin(after-only): after hook: filename: files/1.js
,-[files/1.js:1:1]
1 | let x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x test-plugin(no-var): Use let or const instead of var
,-[files/index.js:3:1]
2 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ Failed to parse configuration file.
x Failed to load JS plugin: ./plugin.js
| Error: whoops!
| at <root>/apps/oxlint/test/fixtures/custom_plugin_import_error/plugin.js:1:7

```
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x Error running JS plugin.
| File path: <root>/apps/oxlint/test/fixtures/custom_plugin_lint_after_hook_error/files/index.js
| Error: Whoops!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x Error running JS plugin.
| File path: <root>/apps/oxlint/test/fixtures/custom_plugin_lint_before_hook_error/files/index.js
| Error: Whoops!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ Failed to parse configuration file.
x Failed to load JS plugin: ./plugin.js
| Error: Whoops!
| at Object.createOnce (<root>/apps/oxlint/test/fixtures/custom_plugin_lint_createOnce_error/plugin.js:8:15)

```
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x Error running JS plugin.
| File path: <root>/apps/oxlint/test/fixtures/custom_plugin_lint_create_error/files/index.js
| Error: Whoops!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x Error running JS plugin.
| File path: <root>/apps/oxlint/test/fixtures/custom_plugin_lint_fix_error/files/index.js
| Error: Whoops!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x Error running JS plugin.
| File path: <root>/apps/oxlint/test/fixtures/custom_plugin_lint_visit_error/files/index.js
| Error: Whoops!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
Failed to parse configuration file.

x Rule 'unknown-rule' not found in plugin 'basic-custom-plugin'

```
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
,-[files/index.js:1:1]
1 | debugger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
Failed to build configuration.

x Rule 'missing' not found in plugin 'basic-custom-plugin'

```
2 changes: 0 additions & 2 deletions apps/oxlint/test/fixtures/definePlugin/eslint.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

<root>/apps/oxlint/test/fixtures/definePlugin/files/1.js
0:1 error create body:
this === rule: true define-plugin-plugin/create
Expand Down Expand Up @@ -89,5 +88,4 @@ filename: files/2.js define-plugin-plugin
filename: files/2.js define-plugin-plugin/create-once-no-hooks

✖ 35 problems (35 errors, 0 warnings)

```
1 change: 0 additions & 1 deletion apps/oxlint/test/fixtures/definePlugin/output.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x define-plugin-plugin(create): create body:
| this === rule: true
,-[files/1.js:1:1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

<root>/apps/oxlint/test/fixtures/definePlugin_and_defineRule/files/1.js
0:1 error create body:
this === rule: true define-plugin-and-rule-plugin/create
Expand Down Expand Up @@ -89,5 +88,4 @@ filename: files/2.js define-plugin-and-ru
filename: files/2.js define-plugin-and-rule-plugin/create-once-no-hooks

✖ 35 problems (35 errors, 0 warnings)

```
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x define-plugin-and-rule-plugin(create): create body:
| this === rule: true
,-[files/1.js:1:1]
Expand Down
2 changes: 0 additions & 2 deletions apps/oxlint/test/fixtures/defineRule/eslint.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

<root>/apps/oxlint/test/fixtures/defineRule/files/1.js
0:1 error create body:
this === rule: true define-rule-plugin/create
Expand Down Expand Up @@ -89,5 +88,4 @@ filename: files/2.js define-rule-plugin/c
filename: files/2.js define-rule-plugin/create-once-no-hooks

✖ 35 problems (35 errors, 0 warnings)

```
1 change: 0 additions & 1 deletion apps/oxlint/test/fixtures/defineRule/output.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x define-rule-plugin(create): create body:
| this === rule: true
,-[files/1.js:1:1]
Expand Down
1 change: 0 additions & 1 deletion apps/oxlint/test/fixtures/estree/output.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x estree-check(check): Visited nodes:
| * Program
| * VariableDeclaration: let
Expand Down
1 change: 0 additions & 1 deletion apps/oxlint/test/fixtures/fixes/fixes_disabled.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

x fixes-plugin(fixes): Remove debugger statement
,-[files/index.js:1:1]
1 | debugger;
Expand Down
1 change: 0 additions & 1 deletion apps/oxlint/test/fixtures/load_paths/output.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed
,-[files/index.js:1:1]
1 | debugger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ Failed to parse configuration file.

x Failed to load JS plugin: ./plugin.js
| Cannot find module './plugin.js'

```
1 change: 0 additions & 1 deletion apps/oxlint/test/fixtures/utf16_offsets/output.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# stdout
```

! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\eslint(no-debugger)]8;;\: `debugger` statement is not allowed
,-[files/index.js:1:1]
1 | debugger;
Expand Down
15 changes: 11 additions & 4 deletions apps/oxlint/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ interface TestFixtureOptions {
export async function testFixtureWithCommand(options: TestFixtureOptions): Promise<void> {
const fixtureDirPath = pathJoin(FIXTURES_DIR_PATH, options.fixtureName);

const { stdout, exitCode } = await execa(options.command, options.args, {
let { stdout, exitCode } = await execa(options.command, options.args, {
cwd: fixtureDirPath,
reject: false,
});

const snapshotPath = pathJoin(fixtureDirPath, `${options.snapshotName}.snap.md`);

const output = normalizeStdout(stdout);
let snapshot = `# Exit code\n${exitCode}\n\n# stdout\n\`\`\`\n${output}\n\`\`\`\n`;
stdout = normalizeStdout(stdout);
let snapshot = `# Exit code\n${exitCode}\n\n` +
`# stdout\n\`\`\`\n${stdout}\`\`\`\n`;

if (options.getExtraSnapshotData) {
const extraSnapshots = await options.getExtraSnapshotData(fixtureDirPath);
Expand Down Expand Up @@ -68,11 +69,16 @@ export async function testFixtureWithCommand(options: TestFixtureOptions): Promi
* - Remove timing + thread count info.
* - Replace start of file paths with `<root>`.
* - Remove irrelevant lines from stack traces.
* - Normalize line breaks.
*
* @param stdout Output from process
* @returns Normalized output
*/
function normalizeStdout(stdout: string): string {
// Normalize line breaks, and trim line breaks from start and end
stdout = stdout.replace(/\r\n?/g, '\n').replace(/^\n+/, '').replace(/\n+$/, '');
if (stdout === '') return '';

let lines = stdout.split('\n');

// Remove timing and thread count info which can vary between runs
Expand Down Expand Up @@ -102,5 +108,6 @@ function normalizeStdout(stdout: string): string {
return [line];
});

return lines.join('\n');
if (lines.length === 0) return '';
return lines.join('\n') + '\n';
}
Loading