@smoothbricks/nx-plugin 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -7
- package/dist/executors/bounded-exec/cpu-tokens.d.ts +13 -0
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-tokens.js +9 -9
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +20 -6
- package/dist/executors/bounded-exec/progress.d.ts +8 -3
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +100 -10
- package/dist/executors/bounded-exec/verdict.d.ts +5 -4
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +1 -0
- package/dist/testing.js +1 -1
- package/managed/raw/patches/nx@23.2.1.patch +26 -0
- package/package.json +2 -2
- package/src/executors/bounded-exec/cpu-tokens.ts +15 -9
- package/src/executors/bounded-exec/executor.test.ts +26 -23
- package/src/executors/bounded-exec/executor.ts +19 -4
- package/src/executors/bounded-exec/go-progress-host.test.ts +171 -0
- package/src/executors/bounded-exec/progress.test.ts +73 -0
- package/src/executors/bounded-exec/progress.ts +95 -12
- package/src/executors/bounded-exec/verdict.ts +5 -4
- package/src/nx-daemon-start-never.test.ts +30 -1
- package/src/testing.ts +1 -1
|
@@ -7,7 +7,7 @@ import { fixtureNxEnv, withNxFixture } from './__tests__/fixture-nx-env.js';
|
|
|
7
7
|
import { awaitExit, isRunning, processTable, terminate } from './testing.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Guards the `NX_DAEMON_START=never`
|
|
10
|
+
* Guards the `NX_DAEMON_START=never` hunks of `patches/nx@23.2.1.patch`. A stock client that finds no live daemon
|
|
11
11
|
* starts one, detached into a session of its own, and the record shares it with every client of the checkout. Cowshed
|
|
12
12
|
* ends a job's whole process tree when the job ends (`specs/cowshed/11_shell.md`), so a daemon one job's client
|
|
13
13
|
* started would end with that job while another job's `nx run` still used it. Every cowshed job therefore runs with
|
|
@@ -124,3 +124,32 @@ it('a client that may never start a daemon continues without one that stopped un
|
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* An explicit `nx daemon --start` calls the daemon start directly, past the implicit-start check above, so under the
|
|
130
|
+
* job's rule it is refused as policy: a non-zero exit naming `NX_DAEMON_START=never` and the fixture escape, and no
|
|
131
|
+
* daemon. The same command without the variable, which is what a test's named fixture escape runs, starts one.
|
|
132
|
+
*/
|
|
133
|
+
it('refuses an explicit daemon start under the job rule, and starts one without it', async () => {
|
|
134
|
+
await withNxFixture('nx-daemon-start-explicit', async ({ workspace, socketDirectory }) => {
|
|
135
|
+
await fixtureWorkspace(workspace);
|
|
136
|
+
const env = { ...fixtureNxEnv(workspace, socketDirectory), NX_DAEMON: 'true' };
|
|
137
|
+
|
|
138
|
+
const refused = spawnSync('bun', [nxEntry, 'daemon', '--start'], {
|
|
139
|
+
cwd: workspace,
|
|
140
|
+
env: { ...env, NX_DAEMON_START: 'never' },
|
|
141
|
+
encoding: 'utf8',
|
|
142
|
+
});
|
|
143
|
+
const said = `${refused.stdout}${refused.stderr}`;
|
|
144
|
+
expect(refused.status, said).toBe(1);
|
|
145
|
+
expect(said).toContain('NX_DAEMON_START=never forbids this client starting a daemon');
|
|
146
|
+
expect(said).toContain('FIXTURE_STARTS_ITS_OWN_DAEMON');
|
|
147
|
+
expect(await recordedPid(workspace)).toBeNull();
|
|
148
|
+
|
|
149
|
+
const started = spawnSync('bun', [nxEntry, 'daemon', '--start'], { cwd: workspace, env, encoding: 'utf8' });
|
|
150
|
+
expect(started.status, `${started.stdout}${started.stderr}`).toBe(0);
|
|
151
|
+
const daemon = await recordedPid(workspace);
|
|
152
|
+
if (daemon === null) throw new Error('an explicit start without the variable left no daemon record');
|
|
153
|
+
expect(isRunning(daemon)).toBe(true);
|
|
154
|
+
});
|
|
155
|
+
});
|
package/src/testing.ts
CHANGED
|
@@ -168,7 +168,7 @@ export async function pidsWorkingIn(root: string): Promise<number[]> {
|
|
|
168
168
|
for (const pid of (await readdir('/proc')).filter((name) => /^\d+$/.test(name))) {
|
|
169
169
|
const cwd = await readlink(`/proc/${pid}/cwd`).catch((error: unknown) => {
|
|
170
170
|
// Another user's process, or one that exited since the listing.
|
|
171
|
-
if (errorCode(error) === 'EACCES' || errorCode(error) === 'ENOENT') {
|
|
171
|
+
if (errorCode(error) === 'EACCES' || errorCode(error) === 'ENOENT' || errorCode(error) === 'ESRCH') {
|
|
172
172
|
return null;
|
|
173
173
|
}
|
|
174
174
|
throw error;
|