mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
support full blaze with test eager loading
This commit is contained in:
4
npm-packages/meteor-rspack/package-lock.json
generated
4
npm-packages/meteor-rspack/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@meteorjs/rspack",
|
||||
"version": "0.0.15",
|
||||
"version": "0.0.17",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@meteorjs/rspack",
|
||||
"version": "0.0.15",
|
||||
"version": "0.0.17",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"ignore-loader": "^0.1.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@meteorjs/rspack",
|
||||
"version": "0.0.15",
|
||||
"version": "0.0.17",
|
||||
"description": "Configuration logic for using Rspack in Meteor projects",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
|
||||
@@ -156,7 +156,7 @@ export default function (inMeteor = {}, argv = {}) {
|
||||
// Set watch options
|
||||
const watchOptions = {
|
||||
...defaultWatchOptions,
|
||||
...isTestEager && {
|
||||
...isTest && isTestEager && {
|
||||
ignored: [
|
||||
...defaultWatchOptions.ignored,
|
||||
'**/_build/**',
|
||||
@@ -296,7 +296,7 @@ export default function (inMeteor = {}, argv = {}) {
|
||||
name: serverNameConfig,
|
||||
target: 'node',
|
||||
mode,
|
||||
entry: isTestEager
|
||||
entry: isTest && isTestEager
|
||||
? "node_modules/@meteorjs/rspack/entries/eager-tests.js"
|
||||
: path.resolve(process.cwd(), buildContext, entryPath),
|
||||
output: {
|
||||
@@ -325,7 +325,7 @@ export default function (inMeteor = {}, argv = {}) {
|
||||
externals,
|
||||
plugins: [
|
||||
new DefinePlugin(
|
||||
isTestModule || isTestEager
|
||||
isTest && (isTestModule || isTestEager)
|
||||
? {
|
||||
"Meteor.isTest": JSON.stringify(isTest),
|
||||
"Meteor.isDevelopment": JSON.stringify(isDev),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
export const DEFAULT_RSPACK_VERSION = '1.4.8';
|
||||
|
||||
export const DEFAULT_METEOR_RSPACK_VERSION = '0.0.15';
|
||||
export const DEFAULT_METEOR_RSPACK_VERSION = '0.0.17';
|
||||
|
||||
export const DEFAULT_METEOR_RSPACK_REACT_HMR_VERSION = '1.4.3';
|
||||
|
||||
|
||||
62
tools/modern-tests/full-blaze.test.js
Normal file
62
tools/modern-tests/full-blaze.test.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import {
|
||||
waitForMeteorOutput,
|
||||
} from "./helpers";
|
||||
import { testMeteorBundler, testMeteorRspackBundler } from './test-helpers';
|
||||
|
||||
describe('Full Blaze App Bundling /', () => {
|
||||
describe('Meteor Bundler /', testMeteorBundler({
|
||||
appName: 'full-blaze',
|
||||
port: 3121
|
||||
}));
|
||||
|
||||
describe('Meteor+Rspack Bundler /', testMeteorRspackBundler({
|
||||
appName: 'full-blaze',
|
||||
port: 3122,
|
||||
filePaths: {
|
||||
client: 'client/main.js',
|
||||
server: 'server/main.js',
|
||||
test: 'imports/api/links/methods.tests.js'
|
||||
},
|
||||
customAssertions: {
|
||||
afterRun: async ({ result }) => {
|
||||
await waitForBlazeEnvs(result.outputLines);
|
||||
},
|
||||
afterRunRebuildClient: async ({ allConsoleLogs }) => {
|
||||
// Check for HMR to not be enabled as incompatible with Blaze
|
||||
await waitForMeteorOutput(allConsoleLogs, /.*HMR.*Updated modules:.*/, { negate: true });
|
||||
},
|
||||
afterRunProduction: async ({ result }) => {
|
||||
await waitForBlazeEnvs(result.outputLines);
|
||||
},
|
||||
afterRunProductionRebuildClient: async ({ allConsoleLogs }) => {
|
||||
// Check for HMR to not be enabled in production-like mode
|
||||
await waitForMeteorOutput(allConsoleLogs, /.*HMR.*Updated modules:*/, { negate: true });
|
||||
},
|
||||
afterTest: async ({ result }) => {
|
||||
await waitForBlazeEnvs(result.outputLines);
|
||||
},
|
||||
afterTestOnce: async ({ result }) => {
|
||||
await waitForBlazeEnvs(result.outputLines);
|
||||
},
|
||||
afterBuild: async ({ result }) => {
|
||||
await waitForBlazeEnvs(result.outputLines);
|
||||
},
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
/**
|
||||
* Helper function to wait for Blaze environment output from both Rspack Client and Server
|
||||
* @param {string[]} outputLines - Array that will be populated with output lines
|
||||
* @param {Object} options - Options for waiting
|
||||
* @param {number} options.timeout - Maximum time to wait in milliseconds
|
||||
* @param {number} options.checkInterval - Interval between checks in milliseconds
|
||||
* @returns {Promise<void>} - A promise that resolves when blaze envs are enabled
|
||||
*/
|
||||
export async function waitForBlazeEnvs(outputLines, options = {}) {
|
||||
await waitForMeteorOutput(
|
||||
outputLines,
|
||||
/.*isBlazeEnabled:.*true.*/,
|
||||
options
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user