Skip to content
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

Refactor error codes in the TS plugin #42585

Merged
merged 1 commit into from Nov 7, 2022
Merged

Refactor error codes in the TS plugin #42585

merged 1 commit into from Nov 7, 2022

Conversation

shuding
Copy link
Member

@shuding shuding commented Nov 7, 2022

Small code refactoring.

Bug

  • Related issues linked using fixes #number
  • Integration tests added
  • Errors have a helpful link attached, see contributing.md

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • Integration tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.
  • Errors have a helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes by running pnpm build && pnpm lint
  • The "examples guidelines" are followed from our contributing doc

huozhi
huozhi approved these changes Nov 7, 2022
@ijjk
Copy link
Member

ijjk commented Nov 7, 2022

Failing test suites

Commit: 3dc802d

pnpm testheadless test/integration/create-next-app/index.test.ts

  • should infer pnpm as the package manager with example

  • create next app > valid example
  • create next app > valid example without package.json
  • create next app > should allow example with GitHub URL
  • create next app > should allow example with GitHub URL with trailing slash
  • create next app > should allow example with GitHub URL and example-path
  • create next app > should use --example-path over the file path in the GitHub URL
  • create next app > should use npm as the package manager on supplying --use-npm with example
  • create next app > should use pnpm as the package manager on supplying --use-pnpm with example
  • create next app > should infer npm as the package manager with example
  • create next app > should infer yarn as the package manager with example
Expand output

● create next app › valid example

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js valid-example --js --eslint --example basic-css

  83 |     await useTempDir(async (cwd) => {
  84 |       const projectName = 'valid-example'
> 85 |       const res = await run(
     |                   ^
  86 |         [projectName, '--js', '--eslint', '--example', 'basic-css'],
  87 |         {
  88 |           cwd,

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
  at integration/create-next-app/index.test.ts:85:19
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:83:5)

● create next app › valid example without package.json

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js valid-example-without-package-json --js --eslint --example with-docker-compose

  106 |     await useTempDir(async (cwd) => {
  107 |       const projectName = 'valid-example-without-package-json'
> 108 |       const res = await run(
      |                   ^
  109 |         [projectName, '--js', '--eslint', '--example', 'with-docker-compose'],
  110 |         {
  111 |           cwd,

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
  at integration/create-next-app/index.test.ts:108:19
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:106:5)

● create next app › should allow example with GitHub URL

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js github-app --js --eslint --example https://github.com/vercel/next.js/tree/canary/examples/basic-css

  125 |     await useTempDir(async (cwd) => {
  126 |       const projectName = 'github-app'
> 127 |       const res = await run(
      |                   ^
  128 |         [
  129 |           projectName,
  130 |           '--js',

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
  at integration/create-next-app/index.test.ts:127:19
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:125:5)

● create next app › should allow example with GitHub URL with trailing slash

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js github-app --js --eslint --example https://github.com/vercel/nextjs-portfolio-starter/

  155 |     await useTempDir(async (cwd) => {
  156 |       const projectName = 'github-app'
> 157 |       const res = await run(
      |                   ^
  158 |         [
  159 |           projectName,
  160 |           '--js',

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
  at integration/create-next-app/index.test.ts:157:19
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:155:5)

● create next app › should allow example with GitHub URL and example-path

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js github-example-path --js --eslint --example https://github.com/vercel/next.js/tree/canary --example-path examples/basic-css

  185 |     await useTempDir(async (cwd) => {
  186 |       const projectName = 'github-example-path'
> 187 |       const res = await run(
      |                   ^
  188 |         [
  189 |           projectName,
  190 |           '--js',

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
  at integration/create-next-app/index.test.ts:187:19
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:185:5)

● create next app › should use --example-path over the file path in the GitHub URL

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js github-example-path-2 --js --eslint --example https://github.com/vercel/next.js/tree/canary/examples/basic-css --example-path examples/basic-css

  217 |     await useTempDir(async (cwd) => {
  218 |       const projectName = 'github-example-path-2'
> 219 |       const res = await run(
      |                   ^
  220 |         [
  221 |           projectName,
  222 |           '--js',

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
  at integration/create-next-app/index.test.ts:219:19
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:217:5)

● create next app › should use npm as the package manager on supplying --use-npm with example

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js use-npm --js --eslint --use-npm --example https://github.com/vercel/next.js/tree/canary/examples/basic-css

  380 |     await useTempDir(async (cwd) => {
  381 |       const projectName = 'use-npm'
> 382 |       const res = await run(
      |                   ^
  383 |         [
  384 |           projectName,
  385 |           '--js',

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
  at integration/create-next-app/index.test.ts:382:19
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:380:5)

● create next app › should use pnpm as the package manager on supplying --use-pnpm with example

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js use-pnpm --js --eslint --use-pnpm --example https://github.com/vercel/next.js/tree/canary/examples/basic-css

  440 |     await useTempDir(async (cwd) => {
  441 |       const projectName = 'use-pnpm'
> 442 |       const res = await run(
      |                   ^
  443 |         [
  444 |           projectName,
  445 |           '--js',

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
  at integration/create-next-app/index.test.ts:442:19
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:440:5)

● create next app › should infer npm as the package manager with example

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js infer-package-manager-npm --js --eslint --example https://github.com/vercel/next.js/tree/canary/examples/basic-css

  492 |     await useTempDir(async (cwd) => {
  493 |       const projectName = 'infer-package-manager-npm'
> 494 |       const res = await run(
      |                   ^
  495 |         [
  496 |           projectName,
  497 |           '--js',

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
  at integration/create-next-app/index.test.ts:494:19
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:492:5)

● create next app › should infer yarn as the package manager with example

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js infer-package-manager-npm --js --eslint --example https://github.com/vercel/next.js/tree/canary/examples/basic-css

  555 |     await useTempDir(async (cwd) => {
  556 |       const projectName = 'infer-package-manager-npm'
> 557 |       const res = await run(
      |                   ^
  558 |         [
  559 |           projectName,
  560 |           '--js',

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
  at integration/create-next-app/index.test.ts:557:19
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:555:5)

● should infer pnpm as the package manager with example

Command failed with exit code 1 (EPERM): node /home/runner/work/next.js/next.js/packages/create-next-app/dist/index.js infer-package-manager-npm --js --eslint --example https://github.com/vercel/next.js/tree/canary/examples/basic-css

  619 |   await useTempDir(async (cwd) => {
  620 |     const projectName = 'infer-package-manager-npm'
> 621 |     const res = await run(
      |                 ^
  622 |       [
  623 |         projectName,
  624 |         '--js',

  at makeError (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/lib/error.js:58:11)
  at handlePromise (../node_modules/.pnpm/execa@2.0.3/node_modules/execa/index.js:112:26)
      at runMicrotasks (<anonymous>)
  at integration/create-next-app/index.test.ts:621:17
  at useTempDir (lib/use-temp-dir.ts:24:5)
  at Object.<anonymous> (integration/create-next-app/index.test.ts:619:3)

Read more about building and testing Next.js in contributing.md.

@shuding shuding merged commit b1932b0 into canary Nov 7, 2022
68 of 69 checks passed
@shuding shuding deleted the shu/0fce branch November 7, 2022 15:02
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants