GeezerVison is showing github.com — tools: enable linter in `test/fixtures/test-runner/output` · nodejs/node@bbbf498
File treeExpand file treeCollapse file tree Open diff view settings test/fixtures/test-runner/output
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: eslint.config.mjs +15Lines changed: 15 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import { readdirSync } from 'node:fs'; | 1 | 2 | import Module from 'node:module'; | 2 | 3 | import { fileURLToPath, URL } from 'node:url'; | 3 | 4 |
| @@ -25,6 +26,12 @@ const { default: stylisticJs } = await importEslintTool('@stylistic/eslint-plugi | 25 | 26 |
| 26 | 27 | nodeCore.RULES_DIR = fileURLToPath(new URL('./tools/eslint-rules', import.meta.url)); | 27 | 28 |
| | 29 | +function filterFilesInDir(dirpath, filterFn) { | | 30 | + return readdirSync(dirpath) | | 31 | + .filter(filterFn) | | 32 | + .map((f) => `${dirpath}/${f}`); | | 33 | +} | | 34 | + | 28 | 35 | // The Module._resolveFilename() monkeypatching is to make it so that ESLint is able to | 29 | 36 | // dynamically load extra modules that we install with it. | 30 | 37 | const ModuleResolveFilename = Module._resolveFilename; | @@ -54,6 +61,14 @@ export default [ | 54 | 61 | 'test/fixtures/*', | 55 | 62 | '!test/fixtures/console', | 56 | 63 | '!test/fixtures/eval', | | 64 | + '!test/fixtures/test-runner', | | 65 | + 'test/fixtures/test-runner/*', | | 66 | + '!test/fixtures/test-runner/output', | | 67 | + ...filterFilesInDir( | | 68 | + 'test/fixtures/test-runner/output', | | 69 | + // Filtering tsc output files (i.e. if there a foo.ts, we ignore foo.js): | | 70 | + (f, _, files) => f.endsWith('js') && files.includes(f.replace(/\.[cm]?js$/, '.ts')), | | 71 | + ), | 57 | 72 | '!test/fixtures/v8', | 58 | 73 | '!test/fixtures/vm', | 59 | 74 | ]), | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/abort_hooks.js +8-8Lines changed: 8 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,8 +5,8 @@ describe('1 before describe', () => { | 5 | 5 | const ac = new AbortController(); | 6 | 6 | before(() => { | 7 | 7 | console.log('before'); | 8 | | - ac.abort() | 9 | | - }, {signal: ac.signal}); | | 8 | + ac.abort(); | | 9 | + }, { signal: ac.signal }); | 10 | 10 |
| 11 | 11 | it('test 1', () => { | 12 | 12 | console.log('1.1'); | @@ -20,8 +20,8 @@ describe('2 after describe', () => { | 20 | 20 | const ac = new AbortController(); | 21 | 21 | after(() => { | 22 | 22 | console.log('after'); | 23 | | - ac.abort() | 24 | | - }, {signal: ac.signal}); | | 23 | + ac.abort(); | | 24 | + }, { signal: ac.signal }); | 25 | 25 |
| 26 | 26 | it('test 1', () => { | 27 | 27 | console.log('2.1'); | @@ -35,8 +35,8 @@ describe('3 beforeEach describe', () => { | 35 | 35 | const ac = new AbortController(); | 36 | 36 | beforeEach(() => { | 37 | 37 | console.log('beforeEach'); | 38 | | - ac.abort() | 39 | | - }, {signal: ac.signal}); | | 38 | + ac.abort(); | | 39 | + }, { signal: ac.signal }); | 40 | 40 |
| 41 | 41 | it('test 1', () => { | 42 | 42 | console.log('3.1'); | @@ -50,8 +50,8 @@ describe('4 afterEach describe', () => { | 50 | 50 | const ac = new AbortController(); | 51 | 51 | afterEach(() => { | 52 | 52 | console.log('afterEach'); | 53 | | - ac.abort() | 54 | | - }, {signal: ac.signal}); | | 53 | + ac.abort(); | | 54 | + }, { signal: ac.signal }); | 55 | 55 |
| 56 | 56 | it('test 1', () => { | 57 | 57 | console.log('4.1'); | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/arbitrary-output-colored.js +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,5 +8,8 @@ const fixtures = require('../../../common/fixtures'); | 8 | 8 | const test = fixtures.path('test-runner/output/arbitrary-output-colored-1.js'); | 9 | 9 | const reset = fixtures.path('test-runner/output/reset-color-depth.js'); | 10 | 10 | await once(spawn(process.execPath, ['-r', reset, '--test', test], { stdio: 'inherit' }), 'exit'); | 11 | | - await once(spawn(process.execPath, ['-r', reset, '--test', '--test-reporter', 'tap', test], { stdio: 'inherit' }), 'exit'); | | 11 | + await once( | | 12 | + spawn(process.execPath, ['-r', reset, '--test', '--test-reporter', 'tap', test], { stdio: 'inherit' }), | | 13 | + 'exit', | | 14 | + ); | 12 | 15 | })().then(common.mustCall()); |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/arbitrary-output.js +9-6Lines changed: 9 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,16 +5,19 @@ const v8_reporter = require('internal/test_runner/reporter/v8-serializer'); | 5 | 5 | const { Buffer } = require('buffer'); | 6 | 6 |
| 7 | 7 |
| 8 | | -(async function () { | | 8 | +// eslint-disable-next-line node-core/async-iife-no-unused-result | | 9 | +(async function() { | 9 | 10 | const reported = v8_reporter([ | 10 | | - { type: "test:pass", data: { name: "test", nesting: 0, file: __filename, testNumber: 1, details: { duration_ms: 0 } } } | | 11 | + { | | 12 | + type: 'test:pass', | | 13 | + data: { name: 'test', nesting: 0, file: __filename, testNumber: 1, details: { duration_ms: 0 } }, | | 14 | + }, | 11 | 15 | ]); | 12 | 16 |
| 13 | 17 | for await (const chunk of reported) { | 14 | 18 | process.stdout.write(chunk); | 15 | | - process.stdout.write(Buffer.concat([Buffer.from("arbitrary - pre"), chunk])); | 16 | | - process.stdout.write(Buffer.from("arbitrary - mid")); | 17 | | - process.stdout.write(Buffer.concat([chunk, Buffer.from("arbitrary - post")])); | | 19 | + process.stdout.write(Buffer.concat([Buffer.from('arbitrary - pre'), chunk])); | | 20 | + process.stdout.write(Buffer.from('arbitrary - mid')); | | 21 | + process.stdout.write(Buffer.concat([chunk, Buffer.from('arbitrary - post')])); | 18 | 22 | } | 19 | 23 | })(); | 20 | | - | |
Collapse file Copy file name to clipboard +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -import assert from 'node:assert/strict' | 2 | | -import { test } from 'node:test' | | 1 | +import assert from 'node:assert/strict'; | | 2 | +import { test } from 'node:test'; | 3 | 3 |
| 4 | 4 | test('failing assertion', () => { | 5 | | - assert.strictEqual('!Hello World', 'Hello World!') | 6 | | -}) | | 5 | + assert.strictEqual('!Hello World', 'Hello World!'); | | 6 | +}); |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/before-and-after-each-too-many-listeners.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | | -const { beforeEach, afterEach, test} = require("node:test"); | | 2 | +const { beforeEach, afterEach, test } = require('node:test'); | 3 | 3 | beforeEach(() => {}); | 4 | 4 | afterEach(() => {}); | 5 | 5 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/before-and-after-each-with-timeout-too-many-listeners.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | | -const { beforeEach, afterEach, test} = require("node:test"); | 3 | | -beforeEach(() => {}, {timeout: 10000}); | 4 | | -afterEach(() => {}, {timeout: 10000}); | | 2 | +const { beforeEach, afterEach, test } = require('node:test'); | | 3 | +beforeEach(() => {}, { timeout: 10000 }); | | 4 | +afterEach(() => {}, { timeout: 10000 }); | 5 | 5 |
| 6 | 6 | for (let i = 1; i <= 11; ++i) { | 7 | 7 | test(`${i}`, () => {}); | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/coverage-width-100-uncovered-lines.mjs +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // Flags: --experimental-test-coverage | 2 | 2 | // here we can't import common module as the coverage will be different based on the system | 3 | 3 | // Unused imports are here in order to populate the coverage report | | 4 | +// eslint-disable-next-line no-unused-vars | 4 | 5 | import * as a from '../coverage-snap/b.js'; | | 6 | +// eslint-disable-next-line no-unused-vars | 5 | 7 | import * as b from '../coverage-snap/a.js'; | | 8 | +// eslint-disable-next-line no-unused-vars | 6 | 9 | import * as c from '../coverage-snap/many-uncovered-lines.js'; | 7 | 10 |
| 8 | 11 | import { test } from 'node:test'; | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/coverage-width-100-uncovered-lines.snapshot +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,6 +28,6 @@ ok 1 - Coverage Print Fixed Width 100 | 28 | 28 | # output | | | | | 29 | 29 | # coverage-width-100-uncovered-lines.mjs | 100.00 | 100.00 | 100.00 | | 30 | 30 | # -------------------------------------------------------------------------------------------------- | 31 | | -# all files | 52.80 | 60.00 | 1.61 | | | 31 | +# all files | 53.13 | 60.00 | 1.61 | | 32 | 32 | # -------------------------------------------------------------------------------------------------- | 33 | 33 | # end of coverage report |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/coverage-width-100.mjs +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | // Flags: --experimental-test-coverage | 2 | 2 | // here we can't import common module as the coverage will be different based on the system | 3 | 3 | // Unused imports are here in order to populate the coverage report | | 4 | +// eslint-disable-next-line no-unused-vars | 4 | 5 | import * as a from '../coverage-snap/b.js'; | | 6 | +// eslint-disable-next-line no-unused-vars | 5 | 7 | import * as b from '../coverage-snap/a.js'; | 6 | 8 |
| 7 | 9 | import { test } from 'node:test'; | |
|