Skip to content

Commit

Permalink
Remove OS eol diffs in tests
Browse files Browse the repository at this point in the history
webpro committed Jul 22, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
jgonggrijp Julian Gonggrijp
1 parent 5d23932 commit 799cc42
Showing 6 changed files with 13 additions and 44 deletions.
4 changes: 0 additions & 4 deletions packages/knip/test/cli/reporter/cli-reporter-json.test.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import { test } from 'bun:test';
import assert from 'node:assert/strict';
import { resolve } from '../../../src/util/path.js';
import { execFactory } from '../../helpers/exec.js';
import { updatePos } from '../../helpers/index.js';

const cwd = resolve('fixtures/exports');

@@ -121,8 +120,5 @@ test('knip --reporter json (exports & types)', () => {
],
};

// Add line - 1 to every pos (each EOL is one more char)
updatePos(json);

assert.equal(exec('knip --reporter json').stdout, `${JSON.stringify(json)}\n`);
});
4 changes: 0 additions & 4 deletions packages/knip/test/cli/reporter/cli-reporter-json2.test.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import { test } from 'bun:test';
import assert from 'node:assert/strict';
import { resolve } from '../../../src/util/path.js';
import { execFactory } from '../../helpers/exec.js';
import { updatePos } from '../../helpers/index.js';

const cwd = resolve('fixtures/module-resolution-non-std');

@@ -28,8 +27,5 @@ test('knip --reporter json (files, unlisted & unresolved)', () => {
],
};

// Add line - 1 to every pos (each EOL is one more char)
updatePos(json);

assert.equal(exec('knip --reporter json').stdout, `${JSON.stringify(json)}\n`);
});
4 changes: 0 additions & 4 deletions packages/knip/test/cli/reporter/cli-reporter-json3.test.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import { test } from 'bun:test';
import assert from 'node:assert/strict';
import { resolve } from '../../../src/util/path.js';
import { execFactory } from '../../helpers/exec.js';
import { updatePos } from '../../helpers/index.js';

const cwd = resolve('fixtures/enum-members');

@@ -33,8 +32,5 @@ test('knip --reporter json (enum members)', () => {
],
};

// Add line - 1 to every pos (each EOL is one more char)
updatePos(json);

assert.equal(exec('knip --reporter json').stdout, `${JSON.stringify(json)}\n`);
});
13 changes: 6 additions & 7 deletions packages/knip/test/fix-workspaces.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { test } from 'bun:test';
import assert from 'node:assert/strict';
import { readFile, writeFile } from 'node:fs/promises';
import { EOL } from 'node:os';
import { main } from '../src/index.js';
import { join, resolve } from '../src/util/path.js';
import baseArguments from './helpers/baseArguments.js';
@@ -22,7 +21,7 @@ type T = number;
/** @knipignore */
export type U = number;
`.replace(/\n/g, EOL),
`,
],
[
'package.json',
@@ -36,7 +35,7 @@ export type U = number;
"packages/*"
]
}
`.replace(/\n/g, EOL),
`,
],
[
'packages/lib/exports.ts',
@@ -48,7 +47,7 @@ type T = number;
/** @knipignore */
export type U = number;
`.replace(/\n/g, EOL),
`,
],
[
'packages/lib/package.json',
@@ -59,7 +58,7 @@ export type U = number;
"ignored": "*"
}
}
`.replace(/\n/g, EOL),
`,
],
];

@@ -114,7 +113,7 @@ type T = number;
/** @knipignore */
export type U = number;
`.replace(/\n/g, EOL),
`,
],
[
'packages/lib/exports.ts',
@@ -126,7 +125,7 @@ type T = number;
/** @knipignore */
export type U = number;
`.replace(/\n/g, EOL),
`,
],
];

15 changes: 7 additions & 8 deletions packages/knip/test/fix.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { test } from 'bun:test';
import assert from 'node:assert/strict';
import { readFile, writeFile } from 'node:fs/promises';
import { EOL } from 'node:os';
import { main } from '../src/index.js';
import { join, resolve } from '../src/util/path.js';
import baseArguments from './helpers/baseArguments.js';
@@ -32,15 +31,15 @@ class MyClass {}
/** @knipignore */
export type U = number;
`.replace(/\n/g, EOL),
`,
],
[
'access.js',
await readContents('access.js'),
`module.exports.USED = 1;
`.replace(/\n/g, EOL),
`,
],
[
'exports.js',
@@ -49,7 +48,7 @@ export type U = number;
const identifier2 = 2;
module.exports = { identifier, };
`.replace(/\n/g, EOL),
`,
],
[
'reexports.js',
@@ -59,7 +58,7 @@ export { Rating } from './reexported';
export { One } from './reexported';
export { Col, Col as KCol } from './reexported';
export { Row as KRow, Row } from './reexported';
`.replace(/\n/g, EOL),
`,
],
[
'reexported.js',
@@ -69,7 +68,7 @@ const Three = 2;
export const One = 1;
`.replace(/\n/g, EOL),
`,
],
[
'package.json',
@@ -82,7 +81,7 @@ export const One = 1;
},
"devDependencies": {}
}
`.replace(/\n/g, EOL),
`,
],
];

@@ -145,7 +144,7 @@ export default class MyClass {}
/** @knipignore */
export type U = number;
`.replace(/\n/g, EOL),
`,
],
];

17 changes: 0 additions & 17 deletions packages/knip/test/helpers/index.ts

This file was deleted.

0 comments on commit 799cc42

Please sign in to comment.