cashscript 0.12.0 → 0.12.1
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
const testFramework = globalThis.vi ?? globalThis.jest;
|
|
2
|
+
// Extend Vitest with the custom matchers, this file needs to be imported in the vitest.setup.ts file or the test file
|
|
1
3
|
expect.extend({
|
|
2
4
|
toLog(transaction, match) {
|
|
3
|
-
const loggerSpy =
|
|
5
|
+
const loggerSpy = testFramework.spyOn(console, 'log');
|
|
4
6
|
// Clear any previous calls (if spy reused accidentally)
|
|
5
7
|
loggerSpy.mockClear();
|
|
6
8
|
// silence actual stdout output
|
|
@@ -37,8 +39,18 @@ expect.extend({
|
|
|
37
39
|
}
|
|
38
40
|
return { message, pass: true };
|
|
39
41
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
toFailRequire(transaction) {
|
|
43
|
+
try {
|
|
44
|
+
transaction.debug();
|
|
45
|
+
const message = () => 'Contract function did not fail a require statement.';
|
|
46
|
+
return { message, pass: false };
|
|
47
|
+
}
|
|
48
|
+
catch (transactionError) {
|
|
49
|
+
const receivedText = `Received string: ${this.utils.printReceived(transactionError?.message ?? '')}`;
|
|
50
|
+
const message = () => `Contract function failed a require statement.\n${receivedText}`;
|
|
51
|
+
return { message, pass: true };
|
|
52
|
+
}
|
|
53
|
+
},
|
|
42
54
|
toFailRequireWith(transaction, match) {
|
|
43
55
|
try {
|
|
44
56
|
transaction.debug();
|
|
@@ -60,18 +72,6 @@ expect.extend({
|
|
|
60
72
|
}
|
|
61
73
|
}
|
|
62
74
|
},
|
|
63
|
-
toFailRequire(transaction) {
|
|
64
|
-
try {
|
|
65
|
-
transaction.debug();
|
|
66
|
-
const message = () => 'Contract function did not fail a require statement.';
|
|
67
|
-
return { message, pass: false };
|
|
68
|
-
}
|
|
69
|
-
catch (transactionError) {
|
|
70
|
-
const receivedText = `Received string: ${this.utils.printReceived(transactionError?.message ?? '')}`;
|
|
71
|
-
const message = () => `Contract function failed a require statement.\n${receivedText}`;
|
|
72
|
-
return { message, pass: true };
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
75
|
});
|
|
76
76
|
export {};
|
|
77
|
-
//# sourceMappingURL=
|
|
77
|
+
//# sourceMappingURL=TestExtensions.js.map
|
package/jest/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cashscript",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Easily write and interact with Bitcoin Cash contracts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitcoin cash",
|
|
@@ -33,33 +33,29 @@
|
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "yarn clean && yarn compile",
|
|
36
|
-
"build:test": "yarn clean:test && yarn compile:test",
|
|
37
36
|
"clean": "rm -rf ./dist",
|
|
38
|
-
"clean:test": "rm -rf ./dist-test",
|
|
39
37
|
"compile": "tsc -p tsconfig.build.json",
|
|
40
|
-
"compile:test": "tsc -p tsconfig.test.json",
|
|
41
38
|
"lint": "eslint . --ext .ts --ignore-path ../../.eslintignore",
|
|
42
39
|
"prepare": "yarn build",
|
|
43
40
|
"prepublishOnly": "yarn test && yarn lint",
|
|
44
|
-
"
|
|
45
|
-
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest"
|
|
41
|
+
"test": "vitest run"
|
|
46
42
|
},
|
|
47
43
|
"dependencies": {
|
|
48
44
|
"@bitauth/libauth": "^3.1.0-next.8",
|
|
49
|
-
"@cashscript/utils": "^0.12.
|
|
45
|
+
"@cashscript/utils": "^0.12.1",
|
|
50
46
|
"@electrum-cash/network": "^4.1.3",
|
|
51
47
|
"@mr-zwets/bchn-api-wrapper": "^1.0.1",
|
|
52
48
|
"pako": "^2.1.0",
|
|
53
49
|
"semver": "^7.7.2"
|
|
54
50
|
},
|
|
55
51
|
"devDependencies": {
|
|
56
|
-
"@jest/globals": "^29.7.0",
|
|
57
52
|
"@psf/bch-js": "^6.8.0",
|
|
58
53
|
"@types/pako": "^2.0.3",
|
|
59
54
|
"@types/semver": "^7.5.8",
|
|
55
|
+
"@vitest/coverage-v8": "^4.0.15",
|
|
60
56
|
"eslint": "^8.54.0",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
57
|
+
"typescript": "^5.9.2",
|
|
58
|
+
"vitest": "^4.0.15"
|
|
63
59
|
},
|
|
64
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "e2e12ba611bc0499891fb817e611eddd891c2313"
|
|
65
61
|
}
|