17 lines
944 B
JavaScript
17 lines
944 B
JavaScript
const assert = require('node:assert/strict');
|
|
const { execFileSync } = require('node:child_process');
|
|
const { resolve } = require('node:path');
|
|
const { test } = require('node:test');
|
|
|
|
for (const [label, environment] of [
|
|
['production', { NODE_ENV: 'production', MONGODB_URI: 'mongodb://127.0.0.1:1234/isolated_performance' }],
|
|
['an external database', { NODE_ENV: 'test', MONGODB_URI: 'mongodb://database.example:1234/isolated_performance' }],
|
|
['another local database', { NODE_ENV: 'test', MONGODB_URI: 'mongodb://127.0.0.1:1234/application' }],
|
|
]) {
|
|
test(`previous-runtime replay rejects ${label} before patching application classes`, () => {
|
|
assert.throws(() => execFileSync(process.execPath, [resolve(__dirname, 'perf-previous-runtime.js')], {
|
|
env: { ...process.env, ...environment }, stdio: 'pipe', windowsHide: true,
|
|
}), (error) => /restricted to the disposable local benchmark/.test(String(error.stderr)));
|
|
});
|
|
}
|