@akinon/next 1.89.0-rc.7 → 1.89.0-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.89.0-rc.8
4
+
5
+ ### Minor Changes
6
+
7
+ - d8fad39: ZERO-3370: include plugins test to build stage
8
+ - 943a239: ZERO-3370: add allowJs in akinon-next test tsconfig
9
+ - 0cabbda: ZERO-3370: replace inline monorepo check with reusable utility
10
+
3
11
  ## 1.89.0-rc.7
4
12
 
5
13
  ### Minor Changes
@@ -15,7 +15,8 @@
15
15
  "preserveWatchOutput": true,
16
16
  "skipLibCheck": true,
17
17
  "strict": true,
18
- "jsx": "react-jsx"
18
+ "jsx": "react-jsx",
19
+ "allowJs": true
19
20
  },
20
21
  "exclude": ["node_modules"],
21
22
  "include": [".", "../."]
@@ -5,60 +5,95 @@ const path = require('path');
5
5
  const fs = require('fs');
6
6
  const glob = require('glob');
7
7
  const findBaseDir = require('../utils/find-base-dir');
8
+ const checkMonorepo = require('../utils/check-monorepo');
8
9
 
10
+ const IS_MONOREPO = checkMonorepo() !== null;
9
11
  const BASE_DIR = findBaseDir();
12
+ const PLUGINS = require(path.join(BASE_DIR, 'src', 'plugins.js'));
10
13
 
11
- function isJestAvailable() {
14
+ function findPluginTestFiles(akinonNextPackagePath) {
15
+ const pluginsRootPath = path.join(
16
+ akinonNextPackagePath,
17
+ '..',
18
+ '..',
19
+ IS_MONOREPO ? 'packages' : '@akinon'
20
+ );
21
+
22
+ if (!fs.existsSync(pluginsRootPath)) {
23
+ console.log('Plugins directory not found:', pluginsRootPath);
24
+ return [];
25
+ }
26
+
27
+ return PLUGINS.reduce((testFiles, pluginName) => {
28
+ const pluginDirectoryPath = path.join(pluginsRootPath, pluginName);
29
+ if (fs.existsSync(pluginDirectoryPath)) {
30
+ const pluginTestFiles = glob.sync('**/*.test.ts', {
31
+ cwd: pluginDirectoryPath,
32
+ absolute: true
33
+ });
34
+
35
+ return testFiles.concat(pluginTestFiles);
36
+ } else {
37
+ console.log(`Plugin directory not found: ${pluginName}`);
38
+ }
39
+ return testFiles;
40
+ }, []);
41
+ }
42
+
43
+ function isJestInstalled() {
12
44
  try {
13
- const jestPath = path.join(BASE_DIR, 'node_modules', '.bin', 'jest');
14
- return fs.existsSync(jestPath);
45
+ const jestExecutablePath = path.join(
46
+ BASE_DIR,
47
+ 'node_modules',
48
+ '.bin',
49
+ 'jest'
50
+ );
51
+ return fs.existsSync(jestExecutablePath);
15
52
  } catch (error) {
16
53
  return false;
17
54
  }
18
55
  }
19
56
 
20
- function findAkinonNextPath() {
21
- const insideNodeModules = __dirname.includes('node_modules');
22
-
23
- if (insideNodeModules) {
57
+ function getAkinonNextPackagePath() {
58
+ if (!IS_MONOREPO) {
24
59
  return path.resolve(__dirname, '..');
25
60
  }
26
61
 
27
62
  return path.resolve(__dirname, '../../../packages/akinon-next');
28
63
  }
29
64
 
30
- if (!isJestAvailable()) {
31
- console.error('\x1b[31mError: Jest is not available!\x1b[0m');
65
+ if (!isJestInstalled()) {
66
+ console.error('\x1b[31mError: Jest is not installed in the project!\x1b[0m');
32
67
  console.error(
33
- 'Please make sure you have installed all dependencies by running:'
68
+ 'Please install all dependencies by running one of the following commands:'
34
69
  );
35
70
  console.error(' npm install');
36
- console.error('or');
37
71
  console.error(' yarn install');
38
72
  process.exit(1);
39
73
  }
40
74
 
41
- const jestPath = path.join(BASE_DIR, 'node_modules', '.bin', 'jest');
42
- const akinonNextPath = findAkinonNextPath();
75
+ const jestExecutablePath = path.join(BASE_DIR, 'node_modules', '.bin', 'jest');
76
+ const akinonNextPackagePath = getAkinonNextPackagePath();
43
77
 
44
- const testFiles = glob.sync('__tests__/**/*.test.ts', {
45
- cwd: akinonNextPath,
46
- absolute: true
47
- });
78
+ const testFiles = [
79
+ ...glob.sync('__tests__/**/*.test.ts', {
80
+ cwd: akinonNextPackagePath,
81
+ absolute: true
82
+ }),
83
+ ...findPluginTestFiles(akinonNextPackagePath)
84
+ ];
48
85
 
49
- const jestArgs = [
86
+ console.log(`Found ${testFiles.length} test files to run`);
87
+
88
+ const jestArguments = [
50
89
  ...testFiles,
51
- `--config ${path.join(akinonNextPath, 'jest.config.js')}`,
90
+ `--config ${path.join(akinonNextPackagePath, 'jest.config.js')}`,
52
91
  '--runTestsByPath',
53
92
  '--passWithNoTests'
54
93
  ];
55
94
 
56
- const jestProcess = spawn(jestPath, jestArgs, {
57
- cwd: akinonNextPath,
95
+ spawn(jestExecutablePath, jestArguments, {
96
+ cwd: akinonNextPackagePath,
58
97
  stdio: 'inherit',
59
98
  shell: true
60
99
  });
61
-
62
- jestProcess.on('close', (code) => {
63
- process.exit(code);
64
- });
package/jest.config.js CHANGED
@@ -4,7 +4,7 @@ module.exports = {
4
4
  preset: 'ts-jest',
5
5
  testEnvironment: 'node',
6
6
  rootDir: path.resolve(__dirname),
7
- roots: [path.resolve(__dirname, '__tests__')],
7
+ roots: [],
8
8
  testMatch: ['**/*.test.ts'],
9
9
  testPathIgnorePatterns: [],
10
10
  transformIgnorePatterns: [],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "1.89.0-rc.7",
4
+ "version": "1.89.0-rc.8",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -34,7 +34,7 @@
34
34
  "set-cookie-parser": "2.6.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@akinon/eslint-plugin-projectzero": "1.89.0-rc.7",
37
+ "@akinon/eslint-plugin-projectzero": "1.89.0-rc.8",
38
38
  "@babel/core": "7.26.10",
39
39
  "@babel/preset-env": "7.26.9",
40
40
  "@babel/preset-typescript": "7.27.0",