Skip to content

./integration-tests/yarn-workspaces/yarn-workspaces.test.ts fails #255

Closed
@gomain

Description

@gomain

Running yarn test .*/integration-tests/yarn-workspaces/yarn-workspaces.test.ts produces these results.

yarn run v1.22.4
$ ./run-tests.sh --runInBand ./integration-tests/yarn-workspaces/yarn-workspaces.test.ts
$ rimraf dist patch-package.test*.tgz
$ tsc --project tsconfig.build.json
info Current version: 6.2.2
info New version: 0.0.0
$ rimraf dist/**/*.test.js
info Current version: 0.0.0
info New version: 6.2.2
$ /home/joe/patch-package/node_modules/.bin/jest --runInBand ./integration-tests/yarn-workspaces/yarn-workspaces.test.ts
FAIL integration-tests/yarn-workspaces/yarn-workspaces.test.ts (20.051s)
  Test yarn-workspaces:
    ✕ should exit with 0 status (7ms)
    ✓ should produce output (1ms)
    ✓ should not produce any snapshots (1ms)

  ● Test yarn-workspaces: › should exit with 0 status

    expect(received).toBe(expected) // Object.is equality

    Expected: 0
    Received: 1

      45 | 
      46 |     it("should exit with 0 status", () => {
    > 47 |       expect(result.status).toBe(0)
         |                             ^
      48 |     })
      49 | 
      50 |     const output = result.stdout.toString() + "\n" + result.stderr.toString()

      at Object.<anonymous> (integration-tests/runIntegrationTest.ts:47:29)

  console.error src/spawnSafe.ts:24
    warning workspace-aggregator-23706d10-cf86-423f-b6e1-2b2f76df610e > a > [email protected]: use String.prototype.padStart()
    warning /home/joe/patch-package/patch-package.test.1599467352.tgz > find-yarn-workspace-root > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
    warning /home/joe/patch-package/patch-package.test.1599467352.tgz > find-yarn-workspace-root > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
    npx: installed 150 in 9.722s
    Error: spawnSync git ENOENT
        at Object.spawnSync (internal/child_process.js:1066:20)
        at Object.spawnSync (child_process.js:602:24)
        at Function.spawnSync [as sync] (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/node_modules/cross-spawn/index.js:26:23)
        at Object.exports.spawnSafeSync (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/spawnSafe.js:10:32)
        at git (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/makePatch.js:106:32)
        at Object.makePatch (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/makePatch.js:118:9)
        at /home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/index.js:48:25
        at Array.forEach (<anonymous>)
        at Object.<anonymous> (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/index.js:47:22)
        at Module._compile (internal/modules/cjs/loader.js:1075:30) {
      errno: -2,
      code: 'ENOENT',
      syscall: 'spawnSync git',
      path: 'git',
      spawnargs: [ 'init' ]
    }
    {
      error: Error: spawnSync git ENOENT
          at Object.spawnSync (internal/child_process.js:1066:20)
          at Object.spawnSync (child_process.js:602:24)
          at Function.spawnSync [as sync] (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/node_modules/cross-spawn/index.js:26:23)
          at Object.exports.spawnSafeSync (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/spawnSafe.js:10:32)
          at git (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/makePatch.js:106:32)
          at Object.makePatch (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/makePatch.js:118:9)
          at /home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/index.js:48:25
          at Array.forEach (<anonymous>)
          at Object.<anonymous> (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/index.js:47:22)
          at Module._compile (internal/modules/cjs/loader.js:1075:30) {
        errno: -2,
        code: 'ENOENT',
        syscall: 'spawnSync git',
        path: 'git',
        spawnargs: [ 'init' ]
      },
      status: null,
      signal: null,
      output: null,
      pid: 5749,
      stdout: null,
      stderr: null
    }
    undefined
    

  console.error integration-tests/runIntegrationTest.ts:53
    tarball /home/joe/patch-package/patch-package.test.1599467352.tgz
    add patch-package to root
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    [3/4] Linking dependencies...
    [4/4] Building fresh packages...
    success Saved lockfile.
    success Saved 69 new dependencies.
    info Direct dependencies
    └─ [email protected]
    info All dependencies
    ├─ @yarnpkg/[email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    ├─ [email protected]
    └─ [email protected]
    set up postinstall scripts
    modify hoisted left-pad
    node_modules/left-pad/index.js
     7: module.exports = patch-package;
     22: function patch-package (str, len, ch) {
    create patch file
    patch-package 0.0.0
    • Creating temporary folder
    • Installing [email protected] with yarn
    • Diffing your files with clean files
    ✔ Created file patches/left-pad+1.2.0.patch
    modify unhoisted left-pad
    packages/a/node_modules/left-pad/index.js
     7: module.exports = patch-package;
     22: function patch-package (str, len, ch) {
    create patch file
    patch-package 6.2.2
    • Creating temporary folder
    • Installing [email protected] with yarn
    • Diffing your files with clean files
    
    warning workspace-aggregator-23706d10-cf86-423f-b6e1-2b2f76df610e > a > [email protected]: use String.prototype.padStart()
    warning /home/joe/patch-package/patch-package.test.1599467352.tgz > find-yarn-workspace-root > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
    warning /home/joe/patch-package/patch-package.test.1599467352.tgz > find-yarn-workspace-root > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
    npx: installed 150 in 9.722s
    Error: spawnSync git ENOENT
        at Object.spawnSync (internal/child_process.js:1066:20)
        at Object.spawnSync (child_process.js:602:24)
        at Function.spawnSync [as sync] (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/node_modules/cross-spawn/index.js:26:23)
        at Object.exports.spawnSafeSync (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/spawnSafe.js:10:32)
        at git (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/makePatch.js:106:32)
        at Object.makePatch (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/makePatch.js:118:9)
        at /home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/index.js:48:25
        at Array.forEach (<anonymous>)
        at Object.<anonymous> (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/index.js:47:22)
        at Module._compile (internal/modules/cjs/loader.js:1075:30) {
      errno: -2,
      code: 'ENOENT',
      syscall: 'spawnSync git',
      path: 'git',
      spawnargs: [ 'init' ]
    }
    {
      error: Error: spawnSync git ENOENT
          at Object.spawnSync (internal/child_process.js:1066:20)
          at Object.spawnSync (child_process.js:602:24)
          at Function.spawnSync [as sync] (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/node_modules/cross-spawn/index.js:26:23)
          at Object.exports.spawnSafeSync (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/spawnSafe.js:10:32)
          at git (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/makePatch.js:106:32)
          at Object.makePatch (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/makePatch.js:118:9)
          at /home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/index.js:48:25
          at Array.forEach (<anonymous>)
          at Object.<anonymous> (/home/joe/.npm/_npx/5705/lib/node_modules/patch-package/dist/index.js:47:22)
          at Module._compile (internal/modules/cjs/loader.js:1075:30) {
        errno: -2,
        code: 'ENOENT',
        syscall: 'spawnSync git',
        path: 'git',
        spawnargs: [ 'init' ]
      },
      status: null,
      signal: null,
      output: null,
      pid: 5749,
      stdout: null,
      stderr: null
    }
    undefined
    

Test Suites: 1 failed, 1 total
Tests:       1 failed, 2 passed, 3 total
Snapshots:   0 total
Time:        20.855s
Ran all test suites matching /.\/integration-tests\/yarn-workspaces\/yarn-workspaces.test.ts/i.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Digging through the logs, I've narrowed down the root-cause to this line.

echo "create patch file"
cd packages/a
npx patch-package left-pad

I suspect npx simply downloads the released version of patch-package (which still has issue #181 #253)

Tests should use the current/working version? Not the one in the NPM registry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions