-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rebuild the integration test into a separate package
- Loading branch information
Showing
13 changed files
with
328 additions
and
86 deletions.
There are no files selected for viewing
73 changes: 0 additions & 73 deletions
73
examples/kitchen-sink-of-fsd-issues/reference-output-ubuntu-latest.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from '@steiger/eslint-config' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"private": true, | ||
"name": "@steiger/integration-tests", | ||
"description": "Integration tests for Steiger", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"test": "vitest run", | ||
"update-windows-snapshots": "node ./scripts/update-windows-snapshots.mjs" | ||
}, | ||
"exports": { | ||
".": "./src/index.ts" | ||
}, | ||
"type": "module", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Anton Medvedev", | ||
"email": "[email protected]", | ||
"url": "https://github.com/unordinarity" | ||
}, | ||
{ | ||
"name": "Lev Chelyadinov", | ||
"email": "[email protected]", | ||
"url": "https://github.com/illright" | ||
} | ||
], | ||
"devDependencies": { | ||
"@steiger/eslint-config": "workspace:*", | ||
"@steiger/tsconfig": "workspace:*", | ||
"@total-typescript/ts-reset": "^0.6.1", | ||
"@types/node": "^18.11.9", | ||
"eslint": "^9.16.0", | ||
"get-bin-path": "^11.0.0", | ||
"prettier": "^3.4.2", | ||
"tinyexec": "^0.3.1", | ||
"typescript": "^5.7.2", | ||
"vitest": "^2.1.8" | ||
}, | ||
"dependencies": { | ||
"steiger": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Do not add any other lines of code to this file! | ||
import '@total-typescript/ts-reset' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as fs from 'node:fs/promises' | ||
import { dirname, join } from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
|
||
const snapshotsFolder = join(dirname(fileURLToPath(import.meta.url)), '../tests/__snapshots__') | ||
|
||
// Go through each POSIX snapshot and replace the forward slashes in diagnostic paths with backslashes | ||
for (const file of await fs.readdir(snapshotsFolder)) { | ||
if (file.endsWith('-posix.txt')) { | ||
const windowsSnapshotName = file.slice(0, -'-posix.txt'.length) + '-windows.txt' | ||
const updatedSnapshot = (await fs.readFile(join(snapshotsFolder, file), 'utf8')).replace(/(?<=┌.+)\//gm, '\\') | ||
await fs.writeFile(join(snapshotsFolder, windowsSnapshotName), updatedSnapshot) | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
integration-tests/tests/__snapshots__/smoke-stderr-posix.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
┌ src/entities/user/api/getUser.ts | ||
✘ Forbidden import from higher layer "app". | ||
│ | ||
└ fsd/forbidden-imports (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/forbidden-imports) | ||
|
||
┌ src/entities | ||
✘ Inconsistent pluralization of slice names. Prefer all plural names | ||
✔ Auto-fixable | ||
│ | ||
└ fsd/inconsistent-naming (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/inconsistent-naming) | ||
|
||
┌ src/entities/user | ||
✘ This slice has no references. Consider removing it. | ||
│ | ||
└ fsd/insignificant-slice (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/insignificant-slice) | ||
|
||
┌ src/entities/users | ||
✘ This slice has no references. Consider removing it. | ||
│ | ||
└ fsd/insignificant-slice (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/insignificant-slice) | ||
|
||
┌ src/entities/user/api/getUser.ts | ||
✘ Forbidden sidestep of public API when importing from "@/app/ui/App". | ||
│ | ||
└ fsd/no-public-api-sidestep (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/no-public-api-sidestep) | ||
|
||
┌ src/entities/user/ui/api | ||
✘ Having a folder with the name "api" inside a segment could be confusing because that name is commonly used for segments. Consider renaming it. | ||
│ | ||
└ fsd/no-reserved-folder-names (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/no-reserved-folder-names) | ||
|
||
┌ src/app/ui | ||
✘ Layer "app" should not have "ui" segment. | ||
│ | ||
└ fsd/no-ui-in-app (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/no-ui-in-app) | ||
|
||
┌ src/processes | ||
✘ Layer "processes" is deprecated, avoid using it | ||
│ | ||
└ fsd/no-processes (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/no-processes) | ||
|
||
──────────────────────────────────────────────────────── | ||
Found 8 errors (1 can be fixed automatically with --fix) | ||
|
45 changes: 45 additions & 0 deletions
45
integration-tests/tests/__snapshots__/smoke-stderr-windows.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
┌ src\entities\user\api\getUser.ts | ||
✘ Forbidden import from higher layer "app". | ||
│ | ||
└ fsd/forbidden-imports (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/forbidden-imports) | ||
|
||
┌ src\entities | ||
✘ Inconsistent pluralization of slice names. Prefer all plural names | ||
✔ Auto-fixable | ||
│ | ||
└ fsd/inconsistent-naming (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/inconsistent-naming) | ||
|
||
┌ src\entities\user | ||
✘ This slice has no references. Consider removing it. | ||
│ | ||
└ fsd/insignificant-slice (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/insignificant-slice) | ||
|
||
┌ src\entities\users | ||
✘ This slice has no references. Consider removing it. | ||
│ | ||
└ fsd/insignificant-slice (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/insignificant-slice) | ||
|
||
┌ src\entities\user\api\getUser.ts | ||
✘ Forbidden sidestep of public API when importing from "@/app/ui/App". | ||
│ | ||
└ fsd/no-public-api-sidestep (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/no-public-api-sidestep) | ||
|
||
┌ src\entities\user\ui\api | ||
✘ Having a folder with the name "api" inside a segment could be confusing because that name is commonly used for segments. Consider renaming it. | ||
│ | ||
└ fsd/no-reserved-folder-names (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/no-reserved-folder-names) | ||
|
||
┌ src\app\ui | ||
✘ Layer "app" should not have "ui" segment. | ||
│ | ||
└ fsd/no-ui-in-app (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/no-ui-in-app) | ||
|
||
┌ src\processes | ||
✘ Layer "processes" is deprecated, avoid using it | ||
│ | ||
└ fsd/no-processes (https://github.com/feature-sliced/steiger/tree/master/packages/steiger-plugin-fsd/src/no-processes) | ||
|
||
──────────────────────────────────────────────────────── | ||
Found 8 errors (1 can be fixed automatically with --fix) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as fs from 'node:fs/promises' | ||
import os from 'node:os' | ||
import { dirname, join } from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
import { exec } from 'tinyexec' | ||
|
||
import { expect, test } from 'vitest' | ||
|
||
import { getSteigerBinPath } from '../utils/get-bin-path.js' | ||
|
||
const temporaryDirectory = await fs.realpath(os.tmpdir()) | ||
const steiger = await getSteigerBinPath() | ||
const kitchenSinkExample = join(dirname(fileURLToPath(import.meta.url)), '../../examples/kitchen-sink-of-fsd-issues') | ||
const pathPlatform = os.platform() === 'win32' ? 'windows' : 'posix' | ||
|
||
test('basic functionality in the kitchen sink example project', async () => { | ||
const project = join(temporaryDirectory, 'smoke') | ||
await fs.rm(project, { recursive: true, force: true }) | ||
await fs.cp(kitchenSinkExample, project, { recursive: true }) | ||
|
||
const { stderr } = await exec('node', [steiger, 'src'], { nodeOptions: { cwd: project } }) | ||
|
||
await expect(stderr).toMatchFileSnapshot(join('__snapshots__', `smoke-stderr-${pathPlatform}.txt`)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "@steiger/tsconfig/base.json", | ||
"include": ["./tests", "./reset.d.ts", "utils/get-bin-path.ts"], | ||
"compilerOptions": { | ||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { promises as fs } from 'node:fs' | ||
import * as process from 'node:process' | ||
import { dirname, join } from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
import { getBinPath } from 'get-bin-path' | ||
|
||
/** | ||
* Resolve the full path to the built JS file of the CLI. | ||
* | ||
* Rejects if the file doesn't exist. | ||
*/ | ||
export async function getSteigerBinPath() { | ||
const steiger = (await getBinPath({ cwd: join(dirname(fileURLToPath(import.meta.url)), '../../packages/steiger') }))! | ||
try { | ||
await fs.stat(steiger) | ||
} catch { | ||
console.error('Run `npm run build` before running integration tests') | ||
process.exit(1) | ||
} | ||
|
||
return steiger | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.