eureka-init 1.0.2 → 1.0.5
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/bin/eureka-init.js +11 -1
- package/package.json +4 -1
- package/templates/example.test.js +11 -0
- package/templates/jest.config.js +2 -0
package/bin/eureka-init.js
CHANGED
|
@@ -38,6 +38,16 @@ function setup() {
|
|
|
38
38
|
path.join(cwd, 'jest.setup.js')
|
|
39
39
|
);
|
|
40
40
|
|
|
41
|
+
// 1a. Create example test in src/__tests__
|
|
42
|
+
const testDir = path.join(cwd, 'src', '__tests__');
|
|
43
|
+
if (!fs.existsSync(testDir)) {
|
|
44
|
+
fs.mkdirSync(testDir, { recursive: true });
|
|
45
|
+
}
|
|
46
|
+
copyFile(
|
|
47
|
+
path.join(templateDir, 'example.test.js'),
|
|
48
|
+
path.join(testDir, 'example.test.js')
|
|
49
|
+
);
|
|
50
|
+
|
|
41
51
|
// 2. Initialize Husky
|
|
42
52
|
try {
|
|
43
53
|
console.log('📦 Setting up Husky...');
|
|
@@ -85,7 +95,7 @@ function setup() {
|
|
|
85
95
|
pkg.scripts.format = 'prettier --write .';
|
|
86
96
|
}
|
|
87
97
|
if (!pkg.scripts.test) {
|
|
88
|
-
pkg.scripts.test = 'jest';
|
|
98
|
+
pkg.scripts.test = 'jest --passWithNoTests';
|
|
89
99
|
}
|
|
90
100
|
|
|
91
101
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eureka-init",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Shared configuration for Husky, Commitlint, Prettier, ESLint, and Jest for Eureka Group",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@commitlint/cli": "^19.3.0",
|
|
22
22
|
"@commitlint/config-conventional": "^19.2.2",
|
|
23
|
+
"@testing-library/jest-dom": "^6.4.2",
|
|
24
|
+
"@testing-library/react": "^14.2.1",
|
|
25
|
+
"@testing-library/user-event": "^14.5.2",
|
|
23
26
|
"eslint": "^8.57.0",
|
|
24
27
|
"eslint-config-prettier": "^9.1.0",
|
|
25
28
|
"eslint-plugin-prettier": "^5.1.3",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
describe('Contoh Unit Test', () => {
|
|
2
|
+
test('Sistem Testing Eureka Init harus berjalan', () => {
|
|
3
|
+
const sum = (a, b) => a + b;
|
|
4
|
+
expect(sum(1, 2)).toBe(3);
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
test('Lingkungan JSDOM harus tersedia', () => {
|
|
8
|
+
const element = document.createElement('div');
|
|
9
|
+
expect(element).not.toBeNull();
|
|
10
|
+
});
|
|
11
|
+
});
|
package/templates/jest.config.js
CHANGED
|
@@ -7,4 +7,6 @@ module.exports = {
|
|
|
7
7
|
},
|
|
8
8
|
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
9
9
|
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
10
|
+
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'],
|
|
11
|
+
modulePathIgnorePatterns: ['<rootDir>/.next/'],
|
|
10
12
|
};
|