-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use exit code 3 for errors, 1 for failures #115
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,5 @@ | ||
--- | ||
"@arethetypeswrong/cli": patch | ||
--- | ||
|
||
Use exit code 127 for errors, 1 for failures |
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
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 |
---|---|---|
|
@@ -23,6 +23,8 @@ const tests = [ | |
["[email protected]"], | ||
["[email protected]"], | ||
["[email protected]"], | ||
["[email protected]"], | ||
["[email protected]"], | ||
|
||
["[email protected]", "--entrypoints vue"], | ||
["[email protected]", "--entrypoints . jsx-runtime"], | ||
|
@@ -61,6 +63,7 @@ describe("snapshots", async () => { | |
test(fixture, async () => { | ||
const tarballPath = new URL(`../../../core/test/fixtures/${tarball}`, import.meta.url).pathname; | ||
let stdout; | ||
let stderr = ""; | ||
let exitCode = 0; | ||
try { | ||
stdout = execSync(`${attw} ${tarballPath} ${options ?? defaultOpts}`, { | ||
|
@@ -69,6 +72,7 @@ describe("snapshots", async () => { | |
}); | ||
} catch (error) { | ||
stdout = (error as SpawnSyncReturns<string>).stdout; | ||
stderr = (error as SpawnSyncReturns<string>).stderr; | ||
exitCode = (error as SpawnSyncReturns<string>).status ?? 1; | ||
} | ||
const snapshotURL = new URL(`../snapshots/${fixture.replace(/\//g, "")}.md`, import.meta.url); | ||
|
@@ -79,7 +83,7 @@ describe("snapshots", async () => { | |
"```", | ||
`$ attw ${tarball} ${options ?? defaultOpts}`, | ||
"", | ||
stdout, | ||
[stdout, stderr].filter(Boolean).join("\n"), | ||
"", | ||
"```", | ||
"", | ||
|
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,12 @@ | ||
# [email protected] | ||
|
||
``` | ||
$ attw [email protected] -f table-flipped | ||
|
||
error while checking file: | ||
Expected double-quoted property name in JSON at position 450 | ||
|
||
|
||
``` | ||
|
||
Exit code: 127 |
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,25 @@ | ||
# [email protected] | ||
|
||
``` | ||
$ attw [email protected] -f table-flipped | ||
|
||
|
||
moment v2.29.1 | ||
|
||
Build tools: | ||
- typescript@^1.8.10 | ||
- [email protected] | ||
|
||
No problems found 🌟 | ||
|
||
|
||
┌──────────┬────────┬───────────────────┬───────────────────┬─────────┐ | ||
│ │ node10 │ node16 (from CJS) │ node16 (from ESM) │ bundler │ | ||
├──────────┼────────┼───────────────────┼───────────────────┼─────────┤ | ||
│ "moment" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ | ||
└──────────┴────────┴───────────────────┴───────────────────┴─────────┘ | ||
|
||
|
||
``` | ||
|
||
Exit code: 0 |
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
|
@@ -26,6 +26,8 @@ describe("snapshots", async () => { | |
"[email protected]": "@[email protected]", | ||
}; | ||
|
||
const errorPackages = ["[email protected]"]; | ||
|
||
for (const fixture of fs.readdirSync(new URL("../fixtures", import.meta.url))) { | ||
if (fixture === ".DS_Store" || fixture.startsWith("@types__")) { | ||
continue; | ||
|
@@ -35,10 +37,19 @@ describe("snapshots", async () => { | |
const typesTarball = typesPackages[fixture] | ||
? await readFile(new URL(`../fixtures/${typesPackages[fixture]}`, import.meta.url)) | ||
: undefined; | ||
const pkg = createPackageFromTarballData(tarball); | ||
const analysis = await checkPackage( | ||
typesTarball ? pkg.mergedWithTypes(createPackageFromTarballData(typesTarball)) : pkg | ||
); | ||
let analysis; | ||
try { | ||
const pkg = createPackageFromTarballData(tarball); | ||
analysis = await checkPackage( | ||
typesTarball ? pkg.mergedWithTypes(createPackageFromTarballData(typesTarball)) : pkg, | ||
); | ||
} catch (error) { | ||
if (errorPackages.includes(fixture)) { | ||
return; | ||
} | ||
throw error; | ||
} | ||
|
||
const snapshotURL = new URL(`../snapshots/${fixture}.json`, import.meta.url); | ||
const expectedSnapshot = JSON.stringify(analysis, null, 2) + "\n"; | ||
|
||
|
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,165 @@ | ||
{ | ||
"packageName": "moment", | ||
"packageVersion": "2.29.1", | ||
"types": { | ||
"kind": "included" | ||
}, | ||
"buildTools": { | ||
"typescript": "^1.8.10", | ||
"rollup": "2.17.1" | ||
}, | ||
"entrypoints": { | ||
".": { | ||
"subpath": ".", | ||
"resolutions": { | ||
"node10": { | ||
"name": ".", | ||
"resolutionKind": "node10", | ||
"resolution": { | ||
"fileName": "/node_modules/moment/ts3.1-typings/moment.d.ts", | ||
"isJson": false, | ||
"isTypeScript": true, | ||
"trace": [ | ||
"======== Resolving module 'moment' from '/index.ts'. ========", | ||
"Explicitly specified module resolution kind: 'Node10'.", | ||
"Loading module 'moment' from 'node_modules' folder, target file types: TypeScript, Declaration.", | ||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", | ||
"Found 'package.json' at '/node_modules/moment/package.json'.", | ||
"File '/node_modules/moment.ts' does not exist.", | ||
"File '/node_modules/moment.tsx' does not exist.", | ||
"File '/node_modules/moment.d.ts' does not exist.", | ||
"'package.json' has a 'typesVersions' field with version-specific path mappings.", | ||
"'package.json' has 'typings' field './moment.d.ts' that references '/node_modules/moment/moment.d.ts'.", | ||
"'package.json' has a 'typesVersions' entry '>=3.1' that matches compiler version '5.2.2', looking for a pattern to match module name 'moment.d.ts'.", | ||
"Module name 'moment.d.ts', matched pattern '*'.", | ||
"Trying substitution 'ts3.1-typings/*', candidate module location: 'ts3.1-typings/moment.d.ts'.", | ||
"File '/node_modules/moment/ts3.1-typings/moment.d.ts' exists - use it as a name resolution result.", | ||
"======== Module name 'moment' was successfully resolved to '/node_modules/moment/ts3.1-typings/moment.d.ts' with Package ID 'moment/ts3.1-typings/[email protected]'. ========" | ||
] | ||
}, | ||
"files": [ | ||
"/node_modules/typescript/lib/lib.d.ts", | ||
"/node_modules/moment/ts3.1-typings/moment.d.ts" | ||
], | ||
"visibleProblems": [] | ||
}, | ||
"node16-cjs": { | ||
"name": ".", | ||
"resolutionKind": "node16-cjs", | ||
"resolution": { | ||
"fileName": "/node_modules/moment/ts3.1-typings/moment.d.ts", | ||
"isJson": false, | ||
"isTypeScript": true, | ||
"trace": [ | ||
"======== Resolving module 'moment' from '/index.ts'. ========", | ||
"Explicitly specified module resolution kind: 'Node16'.", | ||
"Resolving in CJS mode with conditions 'require', 'types', 'node'.", | ||
"File '/package.json' does not exist.", | ||
"Loading module 'moment' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", | ||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", | ||
"Found 'package.json' at '/node_modules/moment/package.json'.", | ||
"File '/node_modules/moment.ts' does not exist.", | ||
"File '/node_modules/moment.tsx' does not exist.", | ||
"File '/node_modules/moment.d.ts' does not exist.", | ||
"'package.json' has a 'typesVersions' field with version-specific path mappings.", | ||
"'package.json' has 'typings' field './moment.d.ts' that references '/node_modules/moment/moment.d.ts'.", | ||
"'package.json' has a 'typesVersions' entry '>=3.1' that matches compiler version '5.2.2', looking for a pattern to match module name 'moment.d.ts'.", | ||
"Module name 'moment.d.ts', matched pattern '*'.", | ||
"Trying substitution 'ts3.1-typings/*', candidate module location: 'ts3.1-typings/moment.d.ts'.", | ||
"File '/node_modules/moment/ts3.1-typings/moment.d.ts' exists - use it as a name resolution result.", | ||
"======== Module name 'moment' was successfully resolved to '/node_modules/moment/ts3.1-typings/moment.d.ts' with Package ID 'moment/ts3.1-typings/[email protected]'. ========" | ||
] | ||
}, | ||
"files": [ | ||
"/node_modules/typescript/lib/lib.d.ts", | ||
"/node_modules/moment/ts3.1-typings/moment.d.ts" | ||
], | ||
"visibleProblems": [] | ||
}, | ||
"node16-esm": { | ||
"name": ".", | ||
"resolutionKind": "node16-esm", | ||
"resolution": { | ||
"fileName": "/node_modules/moment/ts3.1-typings/moment.d.ts", | ||
"isJson": false, | ||
"isTypeScript": true, | ||
"trace": [ | ||
"======== Resolving module 'moment' from '/index.mts'. ========", | ||
"Explicitly specified module resolution kind: 'Node16'.", | ||
"Resolving in ESM mode with conditions 'import', 'types', 'node'.", | ||
"File '/package.json' does not exist according to earlier cached lookups.", | ||
"Loading module 'moment' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", | ||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", | ||
"File '/node_modules/moment/package.json' exists according to earlier cached lookups.", | ||
"'package.json' has 'typings' field './moment.d.ts' that references '/node_modules/moment/moment.d.ts'.", | ||
"'package.json' has a 'typesVersions' entry '>=3.1' that matches compiler version '5.2.2', looking for a pattern to match module name 'moment.d.ts'.", | ||
"Module name 'moment.d.ts', matched pattern '*'.", | ||
"Trying substitution 'ts3.1-typings/*', candidate module location: 'ts3.1-typings/moment.d.ts'.", | ||
"File '/node_modules/moment/ts3.1-typings/moment.d.ts' exists - use it as a name resolution result.", | ||
"======== Module name 'moment' was successfully resolved to '/node_modules/moment/ts3.1-typings/moment.d.ts' with Package ID 'moment/ts3.1-typings/[email protected]'. ========" | ||
] | ||
}, | ||
"files": [ | ||
"/node_modules/typescript/lib/lib.d.ts", | ||
"/node_modules/moment/ts3.1-typings/moment.d.ts" | ||
], | ||
"visibleProblems": [] | ||
}, | ||
"bundler": { | ||
"name": ".", | ||
"resolutionKind": "bundler", | ||
"resolution": { | ||
"fileName": "/node_modules/moment/ts3.1-typings/moment.d.ts", | ||
"isJson": false, | ||
"isTypeScript": true, | ||
"trace": [ | ||
"======== Resolving module 'moment' from '/index.ts'. ========", | ||
"Explicitly specified module resolution kind: 'Bundler'.", | ||
"Resolving in CJS mode with conditions 'import', 'types'.", | ||
"File '/package.json' does not exist.", | ||
"Loading module 'moment' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", | ||
"Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", | ||
"Found 'package.json' at '/node_modules/moment/package.json'.", | ||
"File '/node_modules/moment.ts' does not exist.", | ||
"File '/node_modules/moment.tsx' does not exist.", | ||
"File '/node_modules/moment.d.ts' does not exist.", | ||
"'package.json' has a 'typesVersions' field with version-specific path mappings.", | ||
"'package.json' has 'typings' field './moment.d.ts' that references '/node_modules/moment/moment.d.ts'.", | ||
"'package.json' has a 'typesVersions' entry '>=3.1' that matches compiler version '5.2.2', looking for a pattern to match module name 'moment.d.ts'.", | ||
"Module name 'moment.d.ts', matched pattern '*'.", | ||
"Trying substitution 'ts3.1-typings/*', candidate module location: 'ts3.1-typings/moment.d.ts'.", | ||
"File '/node_modules/moment/ts3.1-typings/moment.d.ts' exists - use it as a name resolution result.", | ||
"======== Module name 'moment' was successfully resolved to '/node_modules/moment/ts3.1-typings/moment.d.ts' with Package ID 'moment/ts3.1-typings/[email protected]'. ========" | ||
] | ||
}, | ||
"files": [ | ||
"/node_modules/typescript/lib/lib.d.ts", | ||
"/node_modules/moment/ts3.1-typings/moment.d.ts" | ||
], | ||
"visibleProblems": [] | ||
} | ||
}, | ||
"hasTypes": true, | ||
"isWildcard": false | ||
} | ||
}, | ||
"programInfo": { | ||
"node10": {}, | ||
"node16": { | ||
"moduleKinds": { | ||
"/node_modules/typescript/lib/lib.d.ts": { | ||
"detectedKind": 1, | ||
"detectedReason": "no:type", | ||
"reasonFileName": "/node_modules/typescript/lib/lib.d.ts" | ||
}, | ||
"/node_modules/moment/ts3.1-typings/moment.d.ts": { | ||
"detectedKind": 1, | ||
"detectedReason": "no:type", | ||
"reasonFileName": "/node_modules/moment/package.json" | ||
} | ||
} | ||
}, | ||
"bundler": {} | ||
}, | ||
"problems": [] | ||
} |
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 |
---|---|---|
|
@@ -29,8 +29,6 @@ const excludedSpecs = [ | |
"[email protected]", // File not found: /node_modules/next/types/misc.d.ts | ||
"[email protected]", // File not found: /node_modules/next/types/misc.d.ts | ||
"[email protected]", // File not found: /node_modules/next/types/misc.d.ts | ||
"[email protected]", // Invalid gzip data | ||
"[email protected]", // Invalid gzip data | ||
]; | ||
|
||
// Array of month starts from 2022-01-01 until the first of this month | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were fixed by #103