Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Unit Test (vitest - Windows)
name: Unit Test (Windows)

# TODO: migrate jest tests to rstest later
concurrency:
group: windows-vitest-${{ github.head_ref }}
group: windows-unit-test-${{ github.head_ref }}
cancel-in-progress: true

# Controls when the action will run.
Expand Down Expand Up @@ -51,4 +52,4 @@ jobs:

- name: Test
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
run: pnpm run test:vitest
run: pnpm run test:rstest
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Unit Test (vitest - macOS)
name: Unit Test (macOS)

# TODO: migrate jest tests to rstest later
concurrency:
group: macos-vitest-${{ github.head_ref }}
group: macos-unit-test-${{ github.head_ref }}
cancel-in-progress: true

# Controls when the action will run.
Expand Down Expand Up @@ -50,4 +51,4 @@ jobs:

- name: Test
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
run: pnpm run test:vitest
run: pnpm run test:rstest
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"test": "npm run test:ut",
"test:rspack": "cd tests && pnpm run test:rspack",
"test:jest": "cd tests && pnpm run test:ut",
"test:vitest": "cross-env VITE_CJS_IGNORE_WARNING=true node scripts/vitest-config/vitestRunAll.js",
"test:ut": "pnpm run test:jest && pnpm run test:vitest",
"test:ut:update": "pnpm run test:jest -u && pnpm run test:vitest -u",
"test:rstest": "rstest",
"test:ut": "pnpm run test:jest && pnpm run test:rstest",
"test:ut:update": "pnpm run test:jest -u && pnpm run test:rstest -u",
"test:e2e": "cd tests && npm run test",
"lint:package-json": "cd ./scripts/lint-package-json && pnpm start",
"prepare-build": "cross-env NX_DAEMON=false NX_REJECT_UNKNOWN_LOCAL_CACHE=0 nx run-many -t build -p @modern-js/* --exclude=@modern-js/main-doc,@modern-js/module-tools-docs --maxParallel=4",
Expand Down Expand Up @@ -75,15 +75,14 @@
"@scripts/build": "workspace:*",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitest/ui": "^3.2.4",
"check-dependency-version-consistency": "4.1.1",
"cross-env": "^7.0.3",
"esbuild": "0.25.5",
"husky": "^8.0.3",
"lint-staged": "~13.3.0",
"nx": "^17.3.2",
"rimraf": "^6.1.2",
"vitest": "^3.0.0"
"@rstest/core": "0.6.6"
},
"pnpm": {
"peerDependencyRules": {
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/babel-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"scripts": {
"build": "modern-lib build",
"dev": "modern-lib build --watch",
"test": "vitest run",
"test:watch": "vitest dev"
"test": "rstest run",
"test:watch": "rstest dev"
},
"dependencies": {
"@babel/core": "^7.28.5",
Expand All @@ -70,7 +70,7 @@
"devDependencies": {
"@modern-js/tsconfig": "workspace:*",
"@scripts/build": "workspace:*",
"@scripts/vitest-config": "workspace:*",
"@scripts/rstest-config": "workspace:*",
"@types/node": "^20",
"typescript": "^5.3.0"
},
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/babel-preset/rstest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { withTestPreset } from '@scripts/rstest-config';

export default withTestPreset({
root: __dirname,
testEnvironment: 'node',
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
// Rstest Snapshot v1

exports[`should allow to enable legacy decorator 1`] = `
{
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/babel-preset/tests/__snapshots__/web.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
// Rstest Snapshot v1

exports[`should allow to enable legacy decorator 1`] = `
{
Expand All @@ -24,7 +24,7 @@ exports[`should allow to enable legacy decorator 1`] = `
"version": "7.28.4",
},
],
"<ROOT>/src/pluginLockCorejsVersion.js",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
],
"presets": [
[
Expand Down Expand Up @@ -84,7 +84,7 @@ exports[`should allow to enable specific version decorator 1`] = `
"version": "7.28.4",
},
],
"<ROOT>/src/pluginLockCorejsVersion.js",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
],
"presets": [
[
Expand Down Expand Up @@ -134,7 +134,7 @@ exports[`should provide web preset as expected 1`] = `
"version": "7.28.4",
},
],
"<ROOT>/src/pluginLockCorejsVersion.js",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
],
"presets": [
[
Expand Down Expand Up @@ -225,7 +225,7 @@ exports[`should support inject core-js polyfills by entry 1`] = `
"version": "7.28.4",
},
],
"<ROOT>/src/pluginLockCorejsVersion.js",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
],
"presets": [
[
Expand Down Expand Up @@ -278,7 +278,7 @@ exports[`should support inject core-js polyfills by usage 1`] = `
"version": "7.28.4",
},
],
"<ROOT>/src/pluginLockCorejsVersion.js",
"<WORKSPACE>/packages/cli/babel-preset/src/pluginLockCorejsVersion.js",
],
"presets": [
[
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/babel-preset/tests/node.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from 'vitest';
import { expect, test } from '@rstest/core';
import { getBabelConfigForNode } from '../src/node';

test('should provide node preset as expected', () => {
Expand Down
19 changes: 0 additions & 19 deletions packages/cli/babel-preset/tests/setup.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/cli/babel-preset/tests/web.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from 'vitest';
import { expect, test } from '@rstest/core';
import { getBabelConfigForWeb } from '../src/web';

test('should provide web preset as expected', () => {
Expand Down
12 changes: 0 additions & 12 deletions packages/cli/babel-preset/vitest.config.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/cli/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"scripts": {
"build": "modern-lib build",
"dev": "modern-lib build --watch",
"test": "vitest run",
"test:watch": "vitest dev"
"test": "rstest run",
"test:watch": "rstest watch"
},
"dependencies": {
"@modern-js/flight-server-transform-plugin": "workspace:*",
Expand Down Expand Up @@ -65,7 +65,7 @@
"devDependencies": {
"@modern-js/types": "workspace:*",
"@scripts/build": "workspace:*",
"@scripts/vitest-config": "workspace:*",
"@scripts/rstest-config": "workspace:*",
"@types/html-minifier-terser": "^7.0.2",
"@types/lodash": "^4.17.21",
"react": "^19.2.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/builder/rstest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { withTestPreset } from '@scripts/rstest-config';

export default withTestPreset({
root: __dirname,
testEnvironment: 'node',
});
14 changes: 7 additions & 7 deletions packages/cli/builder/tests/__snapshots__/babel.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
// Rstest Snapshot v1

exports[`plugin-babel (rspack mode) > should merge environment and shared babel config 1`] = `
[
Expand Down Expand Up @@ -45,7 +45,7 @@ exports[`plugin-babel (rspack mode) > should merge environment and shared babel
"isModule": "unknown",
"jsc": {
"experimental": {
"cacheRoot": "node_modules/.cache/.swc",
"cacheRoot": "<WORKSPACE>/packages/cli/builder/node_modules/.cache/.swc",
"keepImportAttributes": true,
},
"externalHelpers": true,
Expand Down Expand Up @@ -176,7 +176,7 @@ exports[`plugin-babel (rspack mode) > should merge environment and shared babel
"isModule": "unknown",
"jsc": {
"experimental": {
"cacheRoot": "node_modules/.cache/.swc",
"cacheRoot": "<WORKSPACE>/packages/cli/builder/node_modules/.cache/.swc",
"keepImportAttributes": true,
},
"externalHelpers": true,
Expand Down Expand Up @@ -299,7 +299,7 @@ exports[`plugin-babel (rspack mode) > should not set babel-loader when babel con
"isModule": "unknown",
"jsc": {
"experimental": {
"cacheRoot": "node_modules/.cache/.swc",
"cacheRoot": "<WORKSPACE>/packages/cli/builder/node_modules/.cache/.swc",
"keepImportAttributes": true,
},
"externalHelpers": true,
Expand Down Expand Up @@ -385,7 +385,7 @@ exports[`plugin-babel (rspack mode) > should set babel-loader when babel config
"isModule": "unknown",
"jsc": {
"experimental": {
"cacheRoot": "node_modules/.cache/.swc",
"cacheRoot": "<WORKSPACE>/packages/cli/builder/node_modules/.cache/.swc",
"keepImportAttributes": true,
},
"externalHelpers": true,
Expand Down Expand Up @@ -508,7 +508,7 @@ exports[`plugin-babel (rspack mode) > should set babel-loader when environment b
"isModule": "unknown",
"jsc": {
"experimental": {
"cacheRoot": "node_modules/.cache/.swc",
"cacheRoot": "<WORKSPACE>/packages/cli/builder/node_modules/.cache/.swc",
"keepImportAttributes": true,
},
"externalHelpers": true,
Expand Down Expand Up @@ -631,7 +631,7 @@ exports[`plugin-babel (rspack mode) > should set babel-loader when environment b
"isModule": "unknown",
"jsc": {
"experimental": {
"cacheRoot": "node_modules/.cache/.swc",
"cacheRoot": "<WORKSPACE>/packages/cli/builder/node_modules/.cache/.swc",
"keepImportAttributes": true,
},
"externalHelpers": true,
Expand Down
14 changes: 7 additions & 7 deletions packages/cli/builder/tests/__snapshots__/cache.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
// Rstest Snapshot v1

exports[`builder rspack with cache > should disable cache by default 1`] = `
{
"buildDependencies": [
"package.json",
"tsconfig.json",
"<WORKSPACE>/packages/cli/builder/package.json",
"<WORKSPACE>/packages/cli/builder/tsconfig.json",
"modern.config.ts",
],
"storage": {
"directory": "node_modules/.cache/rspack",
"directory": "<WORKSPACE>/packages/cli/builder/node_modules/.cache/rspack",
"type": "filesystem",
},
"type": "persistent",
Expand All @@ -19,12 +19,12 @@ exports[`builder rspack with cache > should disable cache by default 1`] = `
exports[`builder rspack with cache > should generator rspack config correctly with cache 1`] = `
{
"buildDependencies": [
"package.json",
"tsconfig.json",
"<WORKSPACE>/packages/cli/builder/package.json",
"<WORKSPACE>/packages/cli/builder/tsconfig.json",
"modern.config.ts",
],
"storage": {
"directory": "node_modules/.cache/rspack",
"directory": "<WORKSPACE>/packages/cli/builder/node_modules/.cache/rspack",
"type": "filesystem",
},
"type": "persistent",
Expand Down
Loading