mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
add file extension module rules assertions
This commit is contained in:
@@ -19,23 +19,41 @@ describe('Babel App Bundling /', () => {
|
||||
},
|
||||
customAssertions: {
|
||||
afterRun: async ({ result }) => {
|
||||
await assertFileExtensionModuleRules(result.outputLines);
|
||||
},
|
||||
afterRunRebuildClient: async ({ allConsoleLogs }) => {
|
||||
// Check for HMR output as enabled by default
|
||||
await waitForMeteorOutput(allConsoleLogs, /.*HMR.*Updated modules:*/);
|
||||
await waitForMeteorOutput(allConsoleLogs, /.*HMR.*Updated modules:.*/);
|
||||
},
|
||||
afterRunProduction: async ({ result }) => {
|
||||
await assertFileExtensionModuleRules(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 assertFileExtensionModuleRules(result.outputLines);
|
||||
},
|
||||
afterTestOnce: async ({ result }) => {
|
||||
await assertFileExtensionModuleRules(result.outputLines);
|
||||
},
|
||||
afterBuild: async ({ result }) => {
|
||||
await assertFileExtensionModuleRules(result.outputLines);
|
||||
},
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
/**
|
||||
* Helper function to assert that output contains expected file extension moduel rules
|
||||
* @param {string[]} outputLines - Array of output lines to check
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function assertFileExtensionModuleRules(outputLines) {
|
||||
// Check for custom and residual rules
|
||||
await waitForMeteorOutput(outputLines, '/\\.(js|jsx)$/');
|
||||
await waitForMeteorOutput(outputLines, '/\\.(tsx|ts|mts|cts|mjs|cjs)$/');
|
||||
await waitForMeteorOutput(outputLines, '/\\.(graphql|gql)$/');
|
||||
await waitForMeteorOutput(outputLines, '/\\.(?:[mc]?js|jsx|[mc]?ts|tsx)$/i', { negate: true });
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('CoffeeScript App Bundling /', () => {
|
||||
},
|
||||
afterRunRebuildClient: async ({ allConsoleLogs }) => {
|
||||
// Check for HMR output as enabled by default
|
||||
await waitForMeteorOutput(allConsoleLogs, /.*HMR.*Updated modules:*/);
|
||||
await waitForMeteorOutput(allConsoleLogs, /.*HMR.*Updated modules:.*/);
|
||||
},
|
||||
afterRunProduction: async ({ result }) => {
|
||||
await waitForCoffeescriptEnvs(result.outputLines);
|
||||
|
||||
@@ -83,7 +83,7 @@ describe('React App Bundling /', () => {
|
||||
},
|
||||
afterRunRebuildClient: async ({ allConsoleLogs }) => {
|
||||
// Check for HMR output as enabled by default
|
||||
await waitForMeteorOutput(allConsoleLogs, /.*HMR.*Updated modules:*/);
|
||||
await waitForMeteorOutput(allConsoleLogs, /.*HMR.*Updated modules:.*/);
|
||||
},
|
||||
afterRunProduction: async ({ result }) => {
|
||||
await waitForReactEnvs(result.outputLines, { isJsxEnabled: true });
|
||||
|
||||
@@ -24,7 +24,7 @@ describe('TypeScript App Bundling /', () => {
|
||||
},
|
||||
afterRunRebuildClient: async ({ allConsoleLogs }) => {
|
||||
// Check for HMR output as enabled by default
|
||||
await waitForMeteorOutput(allConsoleLogs, /.*HMR.*Updated modules:*/);
|
||||
await waitForMeteorOutput(allConsoleLogs, /.*HMR.*Updated modules:.*/);
|
||||
},
|
||||
afterRunProduction: async ({ result }) => {
|
||||
await waitForTypeScriptEnvs(result.outputLines, { isTsxEnabled: true });
|
||||
|
||||
Reference in New Issue
Block a user