Skip to content

Commit

Permalink
Add ability to ignore tests to build example script, ignore failed ex…
Browse files Browse the repository at this point in the history
…ample-react-nextjs-swr test temporarily (#9930)
  • Loading branch information
eddeee888 authored Apr 23, 2024
1 parent 31dec2c commit fcdefb6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/graphql-codegen-cli/tests/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os from 'os';
import { join, parse, relative, resolve } from 'path';
import makeDir from 'make-dir';
import rimraf from 'rimraf';
import * as rimraf from 'rimraf';

const fs = jest.requireActual('fs');

Expand Down
29 changes: 21 additions & 8 deletions scripts/print-example-ci-command.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
/* eslint-disable import/no-extraneous-dependencies, no-console */
// @ts-check
const fs = require('fs-extra');
const fg = require('fast-glob');

const packageJSON = fg.sync(['examples/**/package.json'], { ignore: ['**/node_modules/**'] });

console.log(
packageJSON
.map(packageJSONPath => {
const { name } = fs.readJSONSync(packageJSONPath);
return `yarn workspace ${name} run ${process.argv[2]}`;
})
.join(' && ')
const ignoredPackages = ['example-react-nextjs-swr'];

const result = packageJSON.reduce(
(res, packageJSONPath) => {
const { name } = fs.readJSONSync(packageJSONPath);

if (ignoredPackages.includes(name)) {
res.ignored.push(name);
return res;
}

res.commands.push(`yarn workspace ${name} run ${process.argv[2]}`);
return res;
},
{ ignored: [], commands: [] }
);

if (result.ignored.length > 0) {
result.commands.push(`echo "Ignored packages: ${result.ignored.join(',')}"`);
}

console.log(result.commands.join(' && '));

0 comments on commit fcdefb6

Please sign in to comment.