Skip to content

Commit da2eafc

Browse files
fix(config): exclude cv-frontend-vue folder & switch to jsdom for proper test environment (CircuitVerse#5237)
1 parent ddd614a commit da2eafc

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

jest.config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
module.exports = {
2-
setupFiles: ['./jest.setup.js'],
2+
testEnvironment: 'jsdom',
3+
4+
// To Ensure the environment is ready before running jest.setup.js
5+
setupFilesAfterEnv: ['./jest.setup.js'],
6+
7+
// Only match test files in simulator/spec/ outside of cv-frontend-vue
38
testMatch: ['**/simulator/spec/**/*.spec.js'],
9+
10+
// Explicitly ignore the cv-frontend-vue folder so Jest doesn’t pick up
11+
// ES module or Vitest tests from that sub-project
12+
testPathIgnorePatterns: ['<rootDir>/cv-frontend-vue/'],
13+
414
maxWorkers: '50%',
515
verbose: true,
16+
617
moduleNameMapper: {
718
'\\.(css|less|sass|scss)$': 'identity-obj-proxy',
819
'typeface-nunito': 'identity-obj-proxy',

jest.setup.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
*/
44

55
import Array from './simulator/src/arrayHelpers';
6-
import 'codemirror/addon/hint/show-hint.js';
6+
import 'codemirror/addon/hint/show-hint';
77

8+
// This line makes "global.window" the same as "window"
89
global.window = window;
10+
911
window.Jquery = require('jquery');
1012
window.$ = require('jquery');
1113
global.jQuery = require('jquery');
@@ -19,5 +21,8 @@ window.Array = Array;
1921
const fs = require('fs');
2022
const path = require('path');
2123

22-
const html = fs.readFileSync(path.resolve(`${__dirname}/app/views/simulator/edit.html.erb`), 'utf8');
24+
const html = fs.readFileSync(
25+
path.resolve(`${__dirname}/app/views/simulator/edit.html.erb`),
26+
'utf8',
27+
);
2328
document.documentElement.innerHTML = html.toString();

0 commit comments

Comments
 (0)