Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷(packaged) Move to Vitest #5348

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chilled-peas-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fast-check/packaged": patch
---

👷(packaged) Move to Vitest
3 changes: 0 additions & 3 deletions packages/packaged/babel.config.cjs

This file was deleted.

7 changes: 0 additions & 7 deletions packages/packaged/jest.config.js

This file was deleted.

10 changes: 3 additions & 7 deletions packages/packaged/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build-ci": "yarn build",
"build:publish-types": "tsc -p tsconfig.publish.types.json",
"build:publish-esm": "tsc -p tsconfig.publish.json --module es2015 --moduleResolution node",
"test": "yarn node --experimental-vm-modules $(yarn bin jest) --verbose",
"test": "vitest",
"typecheck": "tsc --noEmit"
},
"repository": {
Expand All @@ -38,14 +38,10 @@
"npm-packlist": "^9.0.0"
},
"devDependencies": {
"@babel/core": "^7.25.8",
"@babel/preset-typescript": "^7.25.7",
"@types/jest": "^29.5.13",
"@types/npm-packlist": "^7.0.3",
"@types/npmcli__arborist": "^5.6.11",
"babel-jest": "^29.7.0",
"jest": "^29.7.0",
"typescript": "~5.6.3"
"typescript": "~5.6.3",
"vitest": "^2.1.3"
},
"keywords": [],
"funding": [
Expand Down
8 changes: 7 additions & 1 deletion packages/packaged/test/packaged.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { describe, it, expect, afterAll } from 'vitest';
import { promises as fs } from 'fs';
import * as path from 'path';
import * as url from 'url';
import { removeNonPublishedFiles } from '../src/packaged';

// @ts-expect-error --module must be higher
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
const testDirname = path.join(__dirname, '..', '.test-artifacts');

afterAll(async () => {
await fs.rmdir(testDirname);
});

describe('removeNonPublishedFiles', () => {
it.each`
Expand Down Expand Up @@ -262,7 +268,7 @@ type RunnerFileSystem = {
async function runPackageTest(runner: (fileSystem: RunnerFileSystem) => Promise<void>): Promise<void> {
const initialWorkingDirectory = process.cwd();
const packageName = `random-package-${Date.now().toString(16)}-${Math.random().toString(16).substring(2)}`;
const packagePath = path.join(__dirname, packageName);
const packagePath = path.join(testDirname, packageName);
try {
const fileSystem: RunnerFileSystem = {
packagePath,
Expand Down
7 changes: 7 additions & 0 deletions packages/packaged/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
include: ['**/test/*.{test,spec}.?(c|m)[jt]s?(x)'],
},
});
6 changes: 1 addition & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3076,16 +3076,12 @@ __metadata:
version: 0.0.0-use.local
resolution: "@fast-check/packaged@workspace:packages/packaged"
dependencies:
"@babel/core": "npm:^7.25.8"
"@babel/preset-typescript": "npm:^7.25.7"
"@npmcli/arborist": "npm:^8.0.0"
"@types/jest": "npm:^29.5.13"
"@types/npm-packlist": "npm:^7.0.3"
"@types/npmcli__arborist": "npm:^5.6.11"
babel-jest: "npm:^29.7.0"
jest: "npm:^29.7.0"
npm-packlist: "npm:^9.0.0"
typescript: "npm:~5.6.3"
vitest: "npm:^2.1.3"
bin:
packaged: ./bin/packaged.js
languageName: unknown
Expand Down