create-fhevm-playground-pro 1.0.22 → 1.0.24

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.
@@ -0,0 +1,7 @@
1
+ // This file is required by ts-node to inject hardhat globals into tests
2
+ import('hardhat').then((hre) => {
3
+ Object.assign(global, {
4
+ ethers: hre.ethers,
5
+ expect: require('chai').expect,
6
+ });
7
+ });
@@ -9,9 +9,9 @@ const config = {
9
9
  artifacts: './artifacts'
10
10
  },
11
11
  mocha: {
12
- extension: ['ts', 'js'],
12
+ extensions: ['ts', 'js'],
13
13
  spec: 'test/**/*.test.{ts,js}',
14
- require: 'ts-node/register',
14
+ require: ['ts-node/register'],
15
15
  timeout: 200000,
16
16
  reporter: 'spec'
17
17
  }
@@ -3,7 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "description": "Base template for fhEVM example projects",
5
5
  "scripts": {
6
- "test": "hardhat test",
6
+ "test": "hardhat compile && mocha --require ts-node/register --require hardhat/register 'test/**/*.test.ts'",
7
7
  "compile": "hardhat compile"
8
8
  },
9
9
  "dependencies": {
@@ -79,6 +79,11 @@ async function createExample(options) {
79
79
  let testContent = fs_extra_1.default.readFileSync(testPath, 'utf-8');
80
80
  // Replace absolute paths: ../../../../scripts/test-helpers -> ./test-helpers.js
81
81
  testContent = testContent.replace(/import\s+{([^}]+)}\s+from\s+"\.\.\/\.\.\/\.\.\/\.\.\/scripts\/test-helpers"/, 'import { $1 } from "./test-helpers.js"');
82
+ // Replace hardhat import to work around ESM/CommonJS issues
83
+ // Change: import { ethers } from "hardhat"
84
+ // To: const { ethers } = await import("hardhat")
85
+ // Actually, just remove the import and use globals injected by Hardhat
86
+ testContent = testContent.replace(/import\s*{\s*ethers\s*}\s*from\s*["']hardhat["']\s*;?\n/g, '');
82
87
  fs_extra_1.default.writeFileSync(testPath, testContent);
83
88
  }
84
89
  // Create test-helpers.js stub if it doesn't exist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fhevm-playground-pro",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Premium scaffolding CLI for fhEVM Playground Pro – Zama bounty",
5
5
  "main": "dist/create-example.js",
6
6
  "bin": {