-
-
Notifications
You must be signed in to change notification settings - Fork 81
feat: debugging in vs code #1153
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
Merged
Merged
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
8931e5a
feat: debugging in vs code
johnnyreilly 0d2a9d2
fix: https://github.com/JoshuaKGoldberg/create-typescript-app/pull/11…
johnnyreilly a092376
fix: speculatively add to the launch.json to fix test
johnnyreilly e1635f8
feat: speculative tests
johnnyreilly b84281c
chore: I hate the spellchecker with the fire of a thousand suns
johnnyreilly f02bd14
chore: remove unused dir
johnnyreilly 76b1dde
Merge branch 'main' into debug-code
johnnyreilly 5e15860
Merge branch 'main' into debug-code
johnnyreilly 438647d
fix: remove problemMatcher
johnnyreilly 8cee7ec
fix: remove problemMatcher
johnnyreilly 2447ec2
Merge branch 'main' into debug-code
johnnyreilly a98171b
Merge branch 'main' into debug-code
johnnyreilly e65aaa0
feat: made launch.json conditional
johnnyreilly 397d4fd
fix: launch.json diff
johnnyreilly 099c9ec
feat: include Josh's tips in error message
johnnyreilly c8ad77b
Merge branch 'main' into debug-code
johnnyreilly 59f1bd8
Merge branch 'main' into debug-code
johnnyreilly eb65439
Merge branch 'main' of https://github.com/JoshuaKGoldberg/create-type…
johnnyreilly 44752ac
feat: documentation
johnnyreilly 659f2cb
Merge branch 'main' into debug-code
johnnyreilly 08e7e69
chore: newline
johnnyreilly 2301020
chore: newline
johnnyreilly 10e5d1c
fix: snapshots
johnnyreilly 001eb3e
Merge branch 'main' of https://github.com/JoshuaKGoldberg/create-type…
johnnyreilly 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
johnnyreilly marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 hidden or 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,11 @@ | ||
{ | ||
"tasks": [ | ||
{ | ||
"detail": "Build the project", | ||
"label": "build", | ||
"script": "build", | ||
"type": "npm" | ||
} | ||
], | ||
"version": "2.0.0" | ||
} |
This file contains hidden or 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 hidden or 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,301 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import { Options } from "../../../shared/types.js"; | ||
import { createDotVSCode } from "./dotVSCode.js"; | ||
|
||
/* spellchecker: disable */ | ||
function fakeOptions( | ||
getExcludeValue: (exclusionName: string) => boolean, | ||
bin?: string | undefined, | ||
) { | ||
return { | ||
access: "public", | ||
author: "TestAuthor", | ||
base: "everything", | ||
...(bin ? { bin } : {}), | ||
description: "Test description.", | ||
directory: ".", | ||
email: { | ||
github: "[email protected]", | ||
npm: "[email protected]", | ||
}, | ||
...Object.fromEntries( | ||
[ | ||
"excludeCompliance", | ||
"excludeAllContributors", | ||
"excludeLintDeprecation", | ||
"excludeLintESLint", | ||
"excludeLintJSDoc", | ||
"excludeLintJson", | ||
"excludeLintKnip", | ||
"excludeLintMd", | ||
"excludeLintPackageJson", | ||
"excludeLintPackages", | ||
"excludeLintPerfectionist", | ||
"excludeLintRegex", | ||
"excludeLintSpelling", | ||
"excludeLintStrict", | ||
"excludeLintStylistic", | ||
"excludeLintYml", | ||
"excludeReleases", | ||
"excludeRenovate", | ||
"excludeTests", | ||
].map((key) => [key, getExcludeValue(key)]), | ||
), | ||
mode: "create", | ||
owner: "TestOwner", | ||
repository: "test-repository", | ||
skipGitHubApi: true, | ||
skipInstall: true, | ||
skipRemoval: true, | ||
title: "Test Title", | ||
} satisfies Options; | ||
} | ||
|
||
describe("createDotVSCode", () => { | ||
it("creates a minimal config when all exclusions are enabled", async () => { | ||
expect(await createDotVSCode(fakeOptions(() => true))) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"extensions.json": "{ | ||
"recommendations": [ | ||
"DavidAnson.vscode-markdownlint", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode" | ||
] | ||
} | ||
", | ||
"settings.json": "{ | ||
"editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"editor.rulers": [80], | ||
"eslint.probe": [ | ||
"javascript", | ||
"javascriptreact", | ||
"json", | ||
"jsonc", | ||
"markdown", | ||
"typescript", | ||
"typescriptreact", | ||
"yaml" | ||
], | ||
"eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }], | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} | ||
", | ||
"tasks.json": "{ | ||
"tasks": [ | ||
{ | ||
"detail": "Build the project", | ||
"label": "build", | ||
"script": "build", | ||
"type": "npm" | ||
} | ||
], | ||
"version": "2.0.0" | ||
} | ||
", | ||
} | ||
`); | ||
}); | ||
|
||
it("creates a full config when all exclusions are disabled and bin is provided", async () => { | ||
expect(await createDotVSCode(fakeOptions(() => false, "bin/index.js"))) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"extensions.json": "{ | ||
"recommendations": [ | ||
"DavidAnson.vscode-markdownlint", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"streetsidesoftware.code-spell-checker" | ||
] | ||
} | ||
", | ||
"launch.json": "{ | ||
"configurations": [ | ||
{ | ||
"args": ["run", "\${relativeFile}"], | ||
"autoAttachChildProcesses": true, | ||
"console": "integratedTerminal", | ||
"name": "Debug Current Test File", | ||
"program": "\${workspaceRoot}/node_modules/vitest/vitest.mjs", | ||
"request": "launch", | ||
"skipFiles": ["<node_internals>/**", "**/node_modules/**"], | ||
"smartStep": true, | ||
"type": "node" | ||
}, | ||
{ | ||
"name": "Debug Program", | ||
"preLaunchTask": "build", | ||
"program": "bin/index.js", | ||
"request": "launch", | ||
"skipFiles": ["<node_internals>/**"], | ||
"type": "node" | ||
} | ||
], | ||
"version": "0.2.0" | ||
} | ||
", | ||
"settings.json": "{ | ||
"editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"editor.rulers": [80], | ||
"eslint.probe": [ | ||
"javascript", | ||
"javascriptreact", | ||
"json", | ||
"jsonc", | ||
"markdown", | ||
"typescript", | ||
"typescriptreact", | ||
"yaml" | ||
], | ||
"eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }], | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} | ||
", | ||
"tasks.json": "{ | ||
"tasks": [ | ||
{ | ||
"detail": "Build the project", | ||
"label": "build", | ||
"script": "build", | ||
"type": "npm" | ||
} | ||
], | ||
"version": "2.0.0" | ||
} | ||
", | ||
} | ||
`); | ||
}); | ||
|
||
it("creates a full config when all exclusions are disabled and bin is not provided", async () => { | ||
expect(await createDotVSCode(fakeOptions(() => false))) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"extensions.json": "{ | ||
"recommendations": [ | ||
"DavidAnson.vscode-markdownlint", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"streetsidesoftware.code-spell-checker" | ||
] | ||
} | ||
", | ||
"launch.json": "{ | ||
"configurations": [ | ||
{ | ||
"args": ["run", "\${relativeFile}"], | ||
"autoAttachChildProcesses": true, | ||
"console": "integratedTerminal", | ||
"name": "Debug Current Test File", | ||
"program": "\${workspaceRoot}/node_modules/vitest/vitest.mjs", | ||
"request": "launch", | ||
"skipFiles": ["<node_internals>/**", "**/node_modules/**"], | ||
"smartStep": true, | ||
"type": "node" | ||
} | ||
], | ||
"version": "0.2.0" | ||
} | ||
", | ||
"settings.json": "{ | ||
"editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"editor.rulers": [80], | ||
"eslint.probe": [ | ||
"javascript", | ||
"javascriptreact", | ||
"json", | ||
"jsonc", | ||
"markdown", | ||
"typescript", | ||
"typescriptreact", | ||
"yaml" | ||
], | ||
"eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }], | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} | ||
", | ||
"tasks.json": "{ | ||
"tasks": [ | ||
{ | ||
"detail": "Build the project", | ||
"label": "build", | ||
"script": "build", | ||
"type": "npm" | ||
} | ||
], | ||
"version": "2.0.0" | ||
} | ||
", | ||
} | ||
`); | ||
}); | ||
|
||
it("creates a minimal config including launch.json when all exclusions are enabled and bin is provided", async () => { | ||
expect(await createDotVSCode(fakeOptions(() => true, "bin/index.js"))) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"extensions.json": "{ | ||
"recommendations": [ | ||
"DavidAnson.vscode-markdownlint", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode" | ||
] | ||
} | ||
", | ||
"launch.json": "{ | ||
"configurations": [ | ||
{ | ||
"name": "Debug Program", | ||
"preLaunchTask": "build", | ||
"program": "bin/index.js", | ||
"request": "launch", | ||
"skipFiles": ["<node_internals>/**"], | ||
"type": "node" | ||
} | ||
], | ||
"version": "0.2.0" | ||
} | ||
", | ||
"settings.json": "{ | ||
"editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"editor.rulers": [80], | ||
"eslint.probe": [ | ||
"javascript", | ||
"javascriptreact", | ||
"json", | ||
"jsonc", | ||
"markdown", | ||
"typescript", | ||
"typescriptreact", | ||
"yaml" | ||
], | ||
"eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }], | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} | ||
", | ||
"tasks.json": "{ | ||
"tasks": [ | ||
{ | ||
"detail": "Build the project", | ||
"label": "build", | ||
"script": "build", | ||
"type": "npm" | ||
} | ||
], | ||
"version": "2.0.0" | ||
} | ||
", | ||
} | ||
`); | ||
}); | ||
}); |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.