Skip to content

Commit c195377

Browse files
committed
feat: migrate packages/cashc jest to vitest
- replace jest with vitest - add vitest configuration file in package - remove jest configuration file
1 parent 3c9e961 commit c195377

File tree

9 files changed

+25
-15
lines changed

9 files changed

+25
-15
lines changed

packages/cashc/jest.config.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/cashc/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"prepare": "yarn build",
4949
"prepublishOnly": "yarn test && yarn lint",
5050
"pretest": "yarn build:test",
51-
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest"
51+
"test": "vitest run"
5252
},
5353
"dependencies": {
5454
"@bitauth/libauth": "^3.1.0-next.2",
@@ -58,17 +58,15 @@
5858
"semver": "^7.7.2"
5959
},
6060
"devDependencies": {
61-
"@jest/globals": "^29.7.0",
62-
"@types/jest": "^29.5.14",
6361
"@types/node": "^22.17.0",
6462
"@types/semver": "^7.7.0",
6563
"cpy-cli": "^5.0.0",
6664
"eslint": "^8.54.0",
6765
"eslint-plugin-import": "^2.31.0",
68-
"jest": "^29.7.0",
6966
"tsx": "^4.20.3",
7067
"typescript": "^5.9.2",
71-
"url-join": "^5.0.0"
68+
"url-join": "^5.0.0",
69+
"vitest": "^3.2.4"
7270
},
7371
"gitHead": "bf02a4b641d5d03c035d052247a545109c17b708"
7472
}

packages/cashc/test/ast/AST.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { parseCode } from '../../src/compiler.js';
1717
import { readCashFiles } from '../test-utils.js';
1818
import { Ast } from '../../src/ast/AST.js';
1919
import OutputSourceCodeTraversal from '../../src/print/OutputSourceCodeTraversal.js';
20+
import { describe, expect, it } from 'vitest';
2021

2122
const VALID_CONTRACT_FILES = new URL('../valid-contract-files', import.meta.url);
2223

packages/cashc/test/ast/Location.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { URL } from 'url';
33
import { compileString, parseCode } from '../../src/compiler.js';
44
import { buildLineToAsmMap, bytecodeToAsm, bytecodeToScript } from '@cashscript/utils';
55
import { hexToBin } from '@bitauth/libauth';
6+
import { describe, expect, it } from 'vitest';
67

78
describe('Location', () => {
89
it('should retrieve correct text from location', () => {

packages/cashc/test/compiler/compiler.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { URL } from 'url';
99
import { getSubdirectories, readCashFiles } from '../test-utils.js';
1010
import * as Errors from '../../src/Errors.js';
1111
import { compileString } from '../../src/index.js';
12+
import { describe, expect, it } from 'vitest';
1213

1314
describe('Compiler', () => {
1415
describe('Successful compilation', () => {

packages/cashc/test/debugging/debugging.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { URL } from 'url';
77
import { compileFile } from '../../src/index.js';
88
import { fixtures } from './fixtures.js';
9+
import { describe, expect, it } from 'vitest';
910

1011
describe('Debugging', () => {
1112
fixtures.forEach((fixture) => {

packages/cashc/test/generation/generation.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { URL } from 'url';
77
import { compileFile } from '../../src/index.js';
88
import { fixtures } from './fixtures.js';
9+
import { describe, it, expect } from 'vitest';
910

1011
describe('Code generation & target code optimisation', () => {
1112
fixtures.forEach((fixture) => {

packages/cashc/vitest.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { defineConfig } from 'vitest/config';
2+
3+
export default defineConfig({
4+
root: './dist-test',
5+
test: {
6+
environment: 'node',
7+
silent: 'passed-only',
8+
include: ['**/*.{test,spec}.?(c|m)[jt]s?(x)'],
9+
setupFiles: ['./vitest.setup.ts'],
10+
exclude: ['**/types/**'],
11+
reporters: ['verbose'],
12+
coverage: {
13+
provider: 'v8',
14+
reporter: ['json-summary'],
15+
},
16+
},
17+
});
File renamed without changes.

0 commit comments

Comments
 (0)