Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b902572
chore: update next tag
zkochan Sep 4, 2024
dbec720
fix(cli)!: `pnpm test` requiring `--` (#8491)
KSXGitHub Sep 4, 2024
d433cb9
feat: adding the package name into the index file name (#8510)
zkochan Sep 13, 2024
dcd2917
feat!: use sha256 for hashing long paths inside `node_modules/.pnpm`
zkochan Sep 15, 2024
bcffd4d
feat!: use SHA256 for hashing the pnpmfile content (#8530)
zkochan Sep 15, 2024
f10256d
feat!: use SHA256 for creating cache keys for dlx (#8531)
zkochan Sep 16, 2024
5d26019
feat!: use SHA256 for storing the checksums for patch files (#8532)
zkochan Sep 18, 2024
501c152
feat!: use SHA256 for hashing side effects cache keys in index files …
zkochan Sep 18, 2024
5284f9d
Merge remote-tracking branch 'origin/main' into v10
zkochan Sep 18, 2024
5bcfc30
fix: usage of getIndexFilePathInCafs in cache.api
zkochan Sep 18, 2024
dfcf034
feat!: set manage-package-manager-versions to true
zkochan Sep 20, 2024
b6206dd
Merge remote-tracking branch 'origin/main' into v10
zkochan Sep 22, 2024
d55b259
fix(dependency-path)!: escape `#` character in directory name (#8557)
hi-ogawa Sep 23, 2024
e9985b6
feat!: default value of virtual-store-dir-max-length set to 60 on Win…
zkochan Sep 23, 2024
2d5f6a7
refactor: create hashObjectNullableWithPrefix (#8601)
KSXGitHub Oct 3, 2024
aae0808
Merge remote-tracking branch 'origin/main' into v10
zkochan Oct 5, 2024
eb626b3
chore(git): merge from main
KSXGitHub Oct 7, 2024
74c6dd3
fix!: the test command should pass all args to the underlying script …
zkochan Oct 8, 2024
7fb4371
fix!: update @yarnpkg/extensions
zkochan Oct 8, 2024
592e2ef
feat!: remove prettier and eslint from the default value of public-ho…
zkochan Oct 9, 2024
b33f153
Merge branch 'main' into v10
zkochan Oct 12, 2024
099e6af
feat!: don't duplicate all file entries in the side effects section o…
zkochan Oct 14, 2024
f35274f
Merge branch 'main' into v10
zkochan Oct 14, 2024
50c3aaf
Merge branch 'main' into v10
zkochan Oct 23, 2024
3198375
perf: use crypto.hash
zkochan Oct 23, 2024
496fbec
test: fix
zkochan Oct 23, 2024
477e0c1
feat!: the link command should add overrides (#8653)
zkochan Oct 24, 2024
9ea8fa4
fix: only validate modules directory if required (e.g. for install) (…
Silic0nS0ldier Oct 24, 2024
790ce1e
Merge branch 'main' into v10
zkochan Oct 25, 2024
8108680
refactor!: changed the format of the side-effects cache key (#8694)
zkochan Oct 26, 2024
284d5e9
Merge remote-tracking branch 'origin/main' into v10
zkochan Oct 26, 2024
298e5dc
feat!: create a separate directory in the store for index files (#8700)
zkochan Oct 27, 2024
30b1fab
refactor: move store version to constants
zkochan Oct 27, 2024
c4f5231
feat!: bump store version to v10 (#8709)
zkochan Oct 28, 2024
32613a0
Merge remote-tracking branch 'origin/main' into v10
zkochan Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix!: the test command should pass all args to the underlying script (#…
  • Loading branch information
zkochan authored Oct 8, 2024
commit 74c6dd3cca1edbc1e60ae3cb104d39f6084d03ed
6 changes: 6 additions & 0 deletions .changeset/friendly-carrots-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@pnpm/plugin-commands-script-runners": major
"pnpm": major
---

`pnpm test` should pass all the params after the `test` keyword to the underlying script. This is similar to how `pnpm run test` works [#8619](https://github.com/pnpm/pnpm/pull/8619).
8 changes: 1 addition & 7 deletions exec/plugin-commands-script-runners/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,5 @@ import * as dlx from './dlx'
import * as exec from './exec'
import * as restart from './restart'
import * as run from './run'
import * as _test from './test'

const test = {
...run,
..._test,
}

export { create, dlx, exec, restart, run, test }
export { create, dlx, exec, restart, run }
5 changes: 4 additions & 1 deletion exec/plugin-commands-script-runners/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export async function handler (
params: string[]
): Promise<string | { exitCode: number } | undefined> {
let dir: string
const [scriptName, ...passedThruArgs] = params
let [scriptName, ...passedThruArgs] = params
if (opts.recursive) {
if (scriptName || Object.keys(opts.selectedProjectsGraph).length > 1) {
return runRecursive(params, opts) as Promise<undefined>
Expand All @@ -203,6 +203,9 @@ export async function handler (
: undefined
return printProjectCommands(manifest, rootManifest ?? undefined)
}
if (opts.fallbackCommandUsed && (scriptName === 't' || scriptName === 'tst')) {
scriptName = 'test'
}

const specifiedScripts = getSpecifiedScripts(manifest.scripts ?? {}, scriptName)

Expand Down
39 changes: 0 additions & 39 deletions exec/plugin-commands-script-runners/src/test.ts

This file was deleted.

5 changes: 2 additions & 3 deletions exec/plugin-commands-script-runners/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir'
import {
restart,
run,
test as testCommand,
} from '@pnpm/plugin-commands-script-runners'
import { prepare, preparePackages } from '@pnpm/prepare'
import { createTestIpcServer } from '@pnpm/test-ipc-server'
Expand Down Expand Up @@ -137,14 +136,14 @@ test('test: pass the args to the command that is specified in the build script o
fs.writeFileSync('args.json', '[]', 'utf8')
fs.writeFileSync('recordArgs.js', RECORD_ARGS_FILE, 'utf8')

await testCommand.handler({
await run.handler({
bin: 'node_modules/.bin',
dir: process.cwd(),
extraBinPaths: [],
extraEnv: {},
pnpmHomeDir: '',
rawConfig: {},
}, ['arg', '--flag=true', '--help', '-h'])
}, ['test', 'arg', '--flag=true', '--help', '-h'])

const { default: args } = await import(path.resolve('args.json'))
expect(args).toStrictEqual([['arg', '--flag=true', '--help', '-h']])
Expand Down
14 changes: 7 additions & 7 deletions exec/plugin-commands-script-runners/test/testRecursive.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path'
import { filterPkgsBySelectorObjects } from '@pnpm/filter-workspace-packages'
import { filterPackagesFromDir } from '@pnpm/workspace.filter-packages-from-dir'
import { test as testCommand } from '@pnpm/plugin-commands-script-runners'
import { run } from '@pnpm/plugin-commands-script-runners'
import { preparePackages } from '@pnpm/prepare'
import { createTestIpcServer } from '@pnpm/test-ipc-server'
import execa from 'execa'
Expand Down Expand Up @@ -62,14 +62,14 @@ test('pnpm recursive test', async () => {
'--store-dir',
path.resolve(DEFAULT_OPTS.storeDir),
])
await testCommand.handler({
await run.handler({
...DEFAULT_OPTS,
allProjects,
dir: process.cwd(),
recursive: true,
selectedProjectsGraph,
workspaceDir: process.cwd(),
})
}, ['test'])

expect(server1.getLines()).toStrictEqual(['project-1', 'project-2'])
expect(server2.getLines()).toStrictEqual(['project-1', 'project-3'])
Expand Down Expand Up @@ -116,14 +116,14 @@ test('`pnpm recursive test` does not fail if none of the packages has a test com
path.resolve(DEFAULT_OPTS.storeDir),
])

await testCommand.handler({
await run.handler({
...DEFAULT_OPTS,
allProjects,
dir: process.cwd(),
recursive: true,
selectedProjectsGraph,
workspaceDir: process.cwd(),
})
}, ['test'])
})

test('pnpm recursive test with filtering', async () => {
Expand Down Expand Up @@ -166,14 +166,14 @@ test('pnpm recursive test with filtering', async () => {
'--store-dir',
path.resolve(DEFAULT_OPTS.storeDir),
])
await testCommand.handler({
await run.handler({
...DEFAULT_OPTS,
allProjects,
dir: process.cwd(),
recursive: true,
selectedProjectsGraph,
workspaceDir: process.cwd(),
})
}, ['test'])

expect(server.getLines()).toStrictEqual(['project-1'])
})
2 changes: 0 additions & 2 deletions pnpm/src/cmd/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
exec,
restart,
run,
test,
} from '@pnpm/plugin-commands-script-runners'
import { server } from '@pnpm/plugin-commands-server'
import { setup } from '@pnpm/plugin-commands-setup'
Expand Down Expand Up @@ -150,7 +149,6 @@ const commands: CommandDefinition[] = [
catFile,
catIndex,
findHash,
test,
unlink,
update,
why,
Expand Down
4 changes: 2 additions & 2 deletions pnpm/src/cmd/installTest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { docsUrl } from '@pnpm/cli-utils'
import { install } from '@pnpm/plugin-commands-installation'
import { test } from '@pnpm/plugin-commands-script-runners'
import { run } from '@pnpm/plugin-commands-script-runners'
import renderHelp from 'render-help'
import { type PnpmOptions } from '../types'

Expand All @@ -21,5 +21,5 @@ export function help (): string {

export async function handler (opts: PnpmOptions, params: string[]): Promise<void> {
await install.handler(opts)
await test.handler(opts as any, params) // eslint-disable-line
await run.handler(opts as any, ['test', ...params]) // eslint-disable-line
}
2 changes: 1 addition & 1 deletion pnpm/test/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ test.each([
{ message: 'npm_command env available on special lifecycle hooks', script: 'prepare', command: 'install' },
{ message: 'npm_command env available on special lifecycle hooks (alias)', script: 'prepare', command: 'i', expected: 'install' },
{ message: 'npm_command env available on pre lifecycle hooks', script: 'prepack', command: 'pack' },
{ message: 'npm_command env available on special commands', script: 'test', command: 'test' },
{ message: 'npm_command env available on special commands', script: 'test', command: 'test', expected: 'run-script' },
{ message: 'npm_command env available on scripts', script: 'dev', command: 'dev', expected: 'run-script' },
])('$message', async ({ script, command, expected }) => {
prepare({
Expand Down
2 changes: 1 addition & 1 deletion pnpm/test/filterProd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test.each([
writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
await execPnpm(['install'])

await execPnpm(['recursive', filter, '...project-3', 'test'])
await execPnpm([filter, '...project-3', 'test'])

expect(server.getLines().sort()).toEqual(expected)
})
4 changes: 2 additions & 2 deletions pnpm/test/monorepo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ test('topological order of packages with self-dependencies in monorepo is correc

expect(server1.getLines()).toStrictEqual(['project-2', 'project-3', 'project-1'])

await execPnpm(['recursive', 'test'])
await execPnpm(['-r', 'test'])

expect(server2.getLines()).toStrictEqual(['project-2', 'project-3', 'project-1'])
})
Expand Down Expand Up @@ -400,7 +400,7 @@ test('test-pattern is respected by the test script', async () => {

await execPnpm(['install'])

await execPnpm(['recursive', '--filter', '...[origin/main]', 'test'])
await execPnpm(['--filter', '...[origin/main]', 'test'])

// Expecting only project-2 and project-4 to run since they were changed above.
expect(server.getLines().sort()).toEqual(['project-2', 'project-4'])
Expand Down
Loading