Skip to content

Commit a291e40

Browse files
author
Rachel
authored
Merge branch 'develop' into issue-22128-certverifyprocbuiltin
2 parents 5edd576 + b865fd4 commit a291e40

File tree

57 files changed

+417
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+417
-217
lines changed

.eslintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { specifiedRules } = require('graphql')
55
const graphqlOpts = {
66
env: 'literal',
77
tagName: 'gql',
8+
// eslint-disable-next-line no-restricted-syntax
89
schemaString: fs.readFileSync(
910
path.join(__dirname, 'packages/graphql/schemas/schema.graphql'),
1011
'utf8',
@@ -33,6 +34,24 @@ module.exports = {
3334
'plugin:@cypress/dev/tests',
3435
],
3536
parser: '@typescript-eslint/parser',
37+
overrides: [
38+
{
39+
files: [
40+
// ignore in tests and scripts
41+
'**/scripts/**',
42+
'**/test/**',
43+
'**/system-tests/**',
44+
'packages/{app,driver,frontend-shared,launchpad}/cypress/**',
45+
'*.test.ts',
46+
// ignore in packages that don't run in the Cypress process
47+
'npm/create-cypress-tests/**',
48+
],
49+
rules: {
50+
'no-restricted-properties': 'off',
51+
'no-restricted-syntax': 'off',
52+
},
53+
},
54+
],
3655
rules: {
3756
'no-duplicate-imports': 'off',
3857
'import/no-duplicates': 'off',
@@ -55,6 +74,16 @@ module.exports = {
5574
message: 'os.userInfo() will throw when there is not an `/etc/passwd` entry for the current user (like when running with --user 12345 in Docker). Do not use it unless you catch any potential errors.',
5675
},
5776
],
77+
'no-restricted-syntax': [
78+
// esquery tool: https://estools.github.io/esquery/
79+
'error',
80+
{
81+
// match sync FS methods except for `existsSync`
82+
// examples: fse.readFileSync, fs.readFileSync, this.ctx.fs.readFileSync...
83+
selector: `MemberExpression[object.name='fs'][property.name=/^[A-z]+Sync$/]:not(MemberExpression[property.name='existsSync']), MemberExpression[property.name=/^[A-z]+Sync$/]:not(MemberExpression[property.name='existsSync']):has(MemberExpression[property.name='fs'])`,
84+
message: 'Synchronous fs calls should not be used in Cypress. Use an async API instead.',
85+
},
86+
],
5887
'graphql/capitalized-type-name': ['warn', graphqlOpts],
5988
'graphql/no-deprecated-fields': ['error', graphqlOpts],
6089
'graphql/template-strings': ['error', { ...graphqlOpts, validators }],

circle.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ mainBuildFilters: &mainBuildFilters
2727
branches:
2828
only:
2929
- develop
30-
- 10.0-release
31-
- linux-arm64
30+
- issue-22147-nohoist
3231

3332
# usually we don't build Mac app - it takes a long time
3433
# but sometimes we want to really confirm we are doing the right thing
@@ -129,7 +128,7 @@ commands:
129128
- run:
130129
name: Check current branch to persist artifacts
131130
command: |
132-
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "linux-arm64" ]]; then
131+
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "issue-22147-nohoist" ]]; then
133132
echo "Not uploading artifacts or posting install comment for this branch."
134133
circleci-agent step halt
135134
fi

cli/scripts/build.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function preparePackageForNpmRelease (json) {
3131
delete json['private']
3232
// no need to include "nyc" code coverage settings
3333
delete json.nyc
34+
delete json.workspaces
3435

3536
_.extend(json, {
3637
version,

npm/eslint-plugin-dev/lib/custom-rules/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const fs = require('fs')
22
const path = require('path')
33

44
module.exports =
5+
// eslint-disable-next-line no-restricted-syntax
56
Object.assign({}, ...fs.readdirSync(__dirname)
67
.filter((filename) => filename.endsWith('.js') && filename !== 'index.js')
78
.map((filename) => ({ [filename.replace(/\.js$/u, '')]: require(path.resolve(__dirname, filename)) })))

npm/vite-dev-server/cypress/e2e/vite-dev-server.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('Config options', () => {
3838
cy.startAppServer('component')
3939

4040
cy.withCtx(async (ctx, { specWithWhitespace }) => {
41-
ctx.actions.file.writeFileInProject(
41+
await ctx.actions.file.writeFileInProject(
4242
ctx.path.join('src', specWithWhitespace),
4343
await ctx.file.readFileInProject(ctx.path.join('src', 'App.cy.jsx')),
4444
)

npm/vite-dev-server/src/plugins/cypress.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export const Cypress = (
3838
const indexHtmlFile = options.cypressConfig.indexHtmlFile
3939

4040
let specsPathsSet = getSpecsPathsSet(specs)
41+
// TODO: use async fs methods here
42+
// eslint-disable-next-line no-restricted-syntax
4143
let loader = fs.readFileSync(INIT_FILEPATH, 'utf8')
4244

4345
devServerEvents.on('dev-server:specs:changed', (specs: Spec[]) => {

npm/webpack-dev-server/src/CypressCTWebpackPlugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,15 @@ export class CypressCTWebpackPlugin {
9999
* has been "updated on disk", causing a recompliation (and pulling the new specs in as
100100
* dependencies).
101101
*/
102-
private onSpecsChange = (specs: Cypress.Cypress['spec'][]) => {
102+
private onSpecsChange = async (specs: Cypress.Cypress['spec'][]) => {
103103
if (!this.compilation || _.isEqual(specs, this.files)) {
104104
return
105105
}
106106

107107
this.files = specs
108108
const inputFileSystem = this.compilation.inputFileSystem
109+
// TODO: don't use a sync fs method here
110+
// eslint-disable-next-line no-restricted-syntax
109111
const utimesSync: UtimesSync = inputFileSystem.fileSystem.utimesSync ?? fs.utimesSync
110112

111113
utimesSync(path.resolve(__dirname, 'browser.js'), new Date(), new Date())

npm/webpack-dev-server/src/helpers/nextHandler.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async function loadWebpackConfig (devServerConfig: WebpackDevServerConfig): Prom
6969
buildId: `@cypress/react-${Math.random().toString()}`,
7070
config: nextConfig,
7171
dev: true,
72-
pagesDir: findPagesDir(devServerConfig.cypressConfig.projectRoot),
72+
pagesDir: await findPagesDir(devServerConfig.cypressConfig.projectRoot),
7373
entrypoints: {},
7474
rewrites: { fallback: [], afterFiles: [], beforeFiles: [] },
7575
...runWebpackSpan,
@@ -106,9 +106,9 @@ function checkSWC (
106106
return false
107107
}
108108

109-
const existsSync = (file: string) => {
109+
const exists = async (file: string) => {
110110
try {
111-
fs.accessSync(file, fs.constants.F_OK)
111+
await fs.promises.access(file, fs.constants.F_OK)
112112

113113
return true
114114
} catch (_) {
@@ -121,16 +121,16 @@ const existsSync = (file: string) => {
121121
* `${projectRoot}/pages` or `${projectRoot}/src/pages`.
122122
* If neither is found, return projectRoot
123123
*/
124-
function findPagesDir (projectRoot: string) {
124+
async function findPagesDir (projectRoot: string) {
125125
// prioritize ./pages over ./src/pages
126126
let pagesDir = path.join(projectRoot, 'pages')
127127

128-
if (existsSync(pagesDir)) {
128+
if (await exists(pagesDir)) {
129129
return pagesDir
130130
}
131131

132132
pagesDir = path.join(projectRoot, 'src', 'pages')
133-
if (existsSync(pagesDir)) {
133+
if (await exists(pagesDir)) {
134134
return pagesDir
135135
}
136136

npm/webpack-dev-server/src/measureWebpackPerformance.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-restricted-syntax */
12
/* eslint-disable no-console */
23
import path from 'path'
34
import fs from 'fs'

npm/webpack-preprocessor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"secure": "nsp check",
1212
"semantic-release": "semantic-release",
1313
"size": "npm pack --dry",
14-
"test": "node ./test-webpack-5.js",
14+
"test": "node ./scripts/test-webpack-5.js",
1515
"test-debug": "node --inspect --debug-brk ./node_modules/.bin/_mocha",
1616
"test-e2e": "mocha test/e2e/*.spec.*",
1717
"test-unit": "mocha test/unit/*.spec.*",

0 commit comments

Comments
 (0)