Skip to content

Commit

Permalink
chore(repo): debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
barbados-clemens committed May 23, 2023
1 parent b656cba commit aad1b31
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
NX_E2E_CI_CACHE_KEY: e2e-circleci-<< parameters.os >>
SELECTED_PM: << parameters.pm >>
NX_E2E_RUN_CYPRESS: 'true'
NX_VERBOSE_LOGGING: 'false'
NX_VERBOSE_LOGGING: 'true'
NX_PERF_LOGGING: 'false'
steps:
- run:
Expand All @@ -151,7 +151,7 @@ jobs:
executor: linux
environment:
NX_E2E_CI_CACHE_KEY: e2e-circleci-linux
NX_VERBOSE_LOGGING: 'false'
NX_VERBOSE_LOGGING: 'true'
NX_DAEMON: 'true'
NX_PERF_LOGGING: 'false'
steps:
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/jest/executors/jest.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"type": "boolean"
},
"randomize": {
"description": "Shuffle the order of the tests within a file. The shuffling is based on the seed. This option is only supported using the default jest-circus test runner.",
"description": "Shuffle delte methe order of the tests within a file. The shuffling is based on the seed. This option is only supported using the default jest-circus test runner.",
"type": "boolean"
},
"runInBand": {
Expand Down
7 changes: 7 additions & 0 deletions packages/cypress/src/executors/cypress/cypress.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,25 @@ export default async function cypressExecutor(

for await (const devServerValues of devServerIter) {
try {
console.log('Running Cypress...');
success = await runCypress(devServerValues.baseUrl, {
...options,
portLockFilePath: devServerValues.portLockFilePath,
});
console.log('Cypress finished', { success });
if (!options.watch) {
console.log('Cypress tests finished, trying to exit the dev server');
devServerIter.return();
break;
}
} catch (e) {
logger.error(e.message);
success = false;
if (!options.watch) {
console.log(
'Cypress tests finished with error, trying to exit the dev server',
e
);
devServerIter.return();
break;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/jest/src/executors/jest/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"type": "boolean"
},
"randomize": {
"description": "Shuffle the order of the tests within a file. The shuffling is based on the seed. This option is only supported using the default jest-circus test runner.",
"description": "Shuffle delte methe order of the tests within a file. The shuffling is based on the seed. This option is only supported using the default jest-circus test runner.",
"type": "boolean"
},
"runInBand": {
Expand Down
9 changes: 9 additions & 0 deletions packages/next/src/executors/server/server.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default async function* serveExecutor(
// Client to check if server is ready.
const client = new net.Socket();
const cleanupClient = () => {
console.log('cleanupClient');
client.removeAllListeners('connect');
client.removeAllListeners('error');
client.end();
Expand All @@ -62,9 +63,11 @@ export default async function* serveExecutor(
};

const waitForServerReady = (retries = 30) => {
console.log('waitForServerReady', retries);
const allowedErrorCodes = ['ECONNREFUSED', 'ECONNRESET'];

client.once('connect', () => {
console.log('connect');
cleanupClient();
next({
success: true,
Expand All @@ -73,17 +76,21 @@ export default async function* serveExecutor(
});

client.on('error', (err) => {
console.log('error', err);
if (retries === 0 || !allowedErrorCodes.includes(err['code'])) {
console.log('actual error');
cleanupClient();
error(err);
} else {
console.log('retrying', retries);
setTimeout(() => waitForServerReady(retries - 1), 1000);
}
});

client.connect({ port, host: '127.0.0.1' });
};

console.log('spawning', command);
const server = spawn(command, {
cwd: options.dev ? root : nextDir,
stdio: 'inherit',
Expand All @@ -93,6 +100,7 @@ export default async function* serveExecutor(
waitForServerReady();

server.once('exit', (code) => {
console.log('server exit', code);
cleanupClient();
if (code === 0) {
done();
Expand All @@ -102,6 +110,7 @@ export default async function* serveExecutor(
});

process.on('exit', async (code) => {
console.log('process exit', code);
if (code === 128 + 2) {
server.kill('SIGINT');
} else if (code === 128 + 1) {
Expand Down

0 comments on commit aad1b31

Please sign in to comment.