fix(testing): fix windows e2e storage ENOENT (#17506)
This commit is contained in:
parent
bf2c42c31e
commit
fc42b7b7ff
@ -161,6 +161,7 @@ pnpm-lock.yaml @nrwl/nx-pipelines-reviewers
|
|||||||
# Scripts
|
# Scripts
|
||||||
/scripts/depcheck @FrozenPandaz @vsavkin @jaysoo
|
/scripts/depcheck @FrozenPandaz @vsavkin @jaysoo
|
||||||
/scripts/documentation @nrwl/nx-docs-reviewers
|
/scripts/documentation @nrwl/nx-docs-reviewers
|
||||||
|
/scripts/local-registry @FrozenPandaz @vsavkin
|
||||||
/scripts/angular-support-upgrades @nrwl/nx-angular-reviewers
|
/scripts/angular-support-upgrades @nrwl/nx-angular-reviewers
|
||||||
|
|
||||||
# CI
|
# CI
|
||||||
|
|||||||
@ -1,22 +1,28 @@
|
|||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { ChildProcess, execSync, spawn } from 'child_process';
|
import { ChildProcess, execSync, fork } from 'child_process';
|
||||||
|
import { tmpdir } from 'tmp';
|
||||||
|
import { existsSync } from 'fs-extra';
|
||||||
|
import { Config } from '@jest/types';
|
||||||
|
|
||||||
export default async function () {
|
export default async function (globalConfig: Config.ConfigGlobals) {
|
||||||
|
const isVerbose =
|
||||||
|
process.env.NX_VERBOSE_LOGGING === 'true' || globalConfig.verbose;
|
||||||
const storageLocation = join(
|
const storageLocation = join(
|
||||||
process.cwd(),
|
tmpdir,
|
||||||
'tmp/local-registry/storage',
|
'local-registry/storage',
|
||||||
process.env.NX_TASK_TARGET_PROJECT ?? ''
|
process.env.NX_TASK_TARGET_PROJECT ?? ''
|
||||||
);
|
);
|
||||||
global.nxLocalRegistryProcess = await new Promise<ChildProcess>(
|
global.nxLocalRegistryProcess = await new Promise<ChildProcess>(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
const childProcess = spawn(
|
const childProcess = fork(
|
||||||
`nx`,
|
require.resolve(`nx`),
|
||||||
`local-registry @nx/nx-source --location none --storage ${storageLocation} --clear ${
|
`local-registry @nx/nx-source --config scripts/local-registry/config.yml --location none --storage ${storageLocation} --clear ${
|
||||||
process.env.NX_E2E_SKIP_BUILD_CLEANUP !== 'true'
|
process.env.NX_E2E_SKIP_BUILD_CLEANUP !== 'true'
|
||||||
}`.split(' ')
|
}`.split(' '),
|
||||||
|
{ stdio: 'pipe' }
|
||||||
);
|
);
|
||||||
|
|
||||||
childProcess.stdout.on('data', (data) => {
|
childProcess?.stdout?.on('data', (data) => {
|
||||||
if (data.toString().includes('http://localhost:')) {
|
if (data.toString().includes('http://localhost:')) {
|
||||||
const port = parseInt(
|
const port = parseInt(
|
||||||
data.toString().match(/localhost:(?<port>\d+)/)?.groups?.port
|
data.toString().match(/localhost:(?<port>\d+)/)?.groups?.port
|
||||||
@ -31,7 +37,7 @@ export default async function () {
|
|||||||
resolve(childProcess);
|
resolve(childProcess);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
childProcess.stderr.on('data', (data) => {
|
childProcess?.stderr?.on('data', (data) => {
|
||||||
process.stderr.write(data);
|
process.stderr.write(data);
|
||||||
reject(data);
|
reject(data);
|
||||||
});
|
});
|
||||||
@ -46,10 +52,13 @@ export default async function () {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (process.env.NX_E2E_SKIP_BUILD_CLEANUP !== 'true') {
|
if (
|
||||||
|
process.env.NX_E2E_SKIP_BUILD_CLEANUP !== 'true' ||
|
||||||
|
!existsSync('./build')
|
||||||
|
) {
|
||||||
console.log('Publishing packages to local registry');
|
console.log('Publishing packages to local registry');
|
||||||
execSync('pnpm nx-release --local major', {
|
execSync('pnpm nx-release --local major', {
|
||||||
stdio: process.env.CI === 'true' ? 'ignore' : 'inherit',
|
stdio: isVerbose ? 'inherit' : 'ignore',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ export async function verdaccioExecutor(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const port = await detectPort(options.port);
|
const port = await detectPort(options.port);
|
||||||
if (port === options.port) {
|
if (port !== options.port) {
|
||||||
logger.info(`Port ${options.port} was occupied. Using port ${port}.`);
|
logger.info(`Port ${options.port} was occupied. Using port ${port}.`);
|
||||||
options.port = port;
|
options.port = port;
|
||||||
}
|
}
|
||||||
|
|||||||
34
scripts/local-registry/config.yml
Normal file
34
scripts/local-registry/config.yml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# path to a directory with all packages
|
||||||
|
storage: ../../tmp/local-registry/storage
|
||||||
|
|
||||||
|
listen: 127.0.0.1:4872 # change to 127.0.0.1 to avoid IPv6 issue
|
||||||
|
|
||||||
|
# a list of other known repositories we can talk to
|
||||||
|
uplinks:
|
||||||
|
npmjs:
|
||||||
|
url: https://registry.npmjs.org/
|
||||||
|
max_fails: 100
|
||||||
|
maxage: 30m
|
||||||
|
fail_timeout: 10m
|
||||||
|
timeout: 600s
|
||||||
|
cache: false
|
||||||
|
|
||||||
|
packages:
|
||||||
|
'@nrwl/*':
|
||||||
|
access: $all
|
||||||
|
publish: $all
|
||||||
|
|
||||||
|
'**':
|
||||||
|
access: $all
|
||||||
|
publish: $all
|
||||||
|
unpublish: $all
|
||||||
|
proxy: npmjs
|
||||||
|
|
||||||
|
# log settings
|
||||||
|
logs:
|
||||||
|
type: stdout
|
||||||
|
format: pretty
|
||||||
|
level: warn
|
||||||
|
|
||||||
|
publish:
|
||||||
|
allow_offline: true # set offline to true to allow publish offline
|
||||||
Loading…
x
Reference in New Issue
Block a user