Skip to content

Commit

Permalink
fix(jest): runInIDE detection for Idea 2023.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Jul 27, 2023
1 parent ebdc159 commit ef74070
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 324 deletions.
4 changes: 2 additions & 2 deletions cfg/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/

// detect if jest is installed
const hasJest = require('fs').existsSync('./node_modules/jest')
const hasJest = require('node:fs').existsSync('./node_modules/jest')
// console.log({hasJest})

module.exports = {
env: {
es2020: true,
es2024: true,
node: true,
jest: true,
// 'jest/globals': true,
Expand Down
6 changes: 4 additions & 2 deletions cfg/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
* Extendable.
*/

const fs = require('fs')
const fs = require('node:fs')

const runInIDE = process.argv.includes('--runTestsByPath')
const runInIDE = process.argv.some(
a => a === '--runTestsByPath' || a.startsWith('--testNamePattern='),
)
const ideIntegrationTest = runInIDE && process.argv.some(a => a.endsWith('.integration.test.ts'))
const ideManualTest = runInIDE && process.argv.some(a => a.endsWith('.manual.test.ts'))
const { CI, GITHUB_ACTIONS } = process.env
Expand Down
5 changes: 3 additions & 2 deletions cfg/jest.integration-test.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Extendable.
*/

const fs = require('fs')
const { CI } = process.env
const fs = require('node:fs')
const { CI, GITHUB_ACTIONS } = process.env
const cwd = process.cwd()

// Set 'setupFilesAfterEnv' only if it exists
Expand Down Expand Up @@ -36,5 +36,6 @@ module.exports = {
ancestorSeparator: ' ',
},
],
GITHUB_ACTIONS && 'github-actions',
].filter(Boolean),
}
2 changes: 1 addition & 1 deletion cfg/jest.manual-test.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Extendable.
*/

const fs = require('fs')
const fs = require('node:fs')
const cwd = process.cwd()

// Set 'setupFilesAfterEnv' only if it exists
Expand Down
2 changes: 1 addition & 1 deletion cfg/lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

const micromatch = require('micromatch')
const fs = require('fs')
const fs = require('node:fs')
const {
prettierDirs,
prettierExtensionsExclusive,
Expand Down
Loading

0 comments on commit ef74070

Please sign in to comment.