feat: Add Node 22 support (#9187)
This commit is contained in:
101
spec/CLI.spec.js
101
spec/CLI.spec.js
@@ -207,6 +207,36 @@ describe('LiveQuery definitions', () => {
|
||||
describe('execution', () => {
|
||||
const binPath = path.resolve(__dirname, '../bin/parse-server');
|
||||
let childProcess;
|
||||
let aggregatedData;
|
||||
|
||||
function handleStdout(childProcess, done, aggregatedData, requiredData) {
|
||||
childProcess.stdout.on('data', data => {
|
||||
data = data.toString();
|
||||
aggregatedData.push(data);
|
||||
if (requiredData.every(required => aggregatedData.some(aggregated => aggregated.includes(required)))) {
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleStderr(childProcess, done) {
|
||||
childProcess.stderr.on('data', data => {
|
||||
data = data.toString();
|
||||
if (!data.includes('[DEP0040] DeprecationWarning')) {
|
||||
done.fail(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleError(childProcess, done) {
|
||||
childProcess.on('error', err => {
|
||||
done.fail(err);
|
||||
});
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
aggregatedData = [];
|
||||
});
|
||||
|
||||
afterEach(done => {
|
||||
if (childProcess) {
|
||||
@@ -220,26 +250,20 @@ describe('execution', () => {
|
||||
|
||||
it('should start Parse Server', done => {
|
||||
const env = { ...process.env };
|
||||
env.NODE_OPTIONS = '--dns-result-order=ipv4first';
|
||||
env.NODE_OPTIONS = '--dns-result-order=ipv4first --trace-deprecation';
|
||||
childProcess = spawn(
|
||||
binPath,
|
||||
['--appId', 'test', '--masterKey', 'test', '--databaseURI', databaseURI, '--port', '1339'],
|
||||
{ env }
|
||||
);
|
||||
childProcess.stdout.on('data', data => {
|
||||
data = data.toString();
|
||||
if (data.includes('parse-server running on')) {
|
||||
done();
|
||||
}
|
||||
});
|
||||
childProcess.stderr.on('data', data => {
|
||||
done.fail(data.toString());
|
||||
});
|
||||
handleStdout(childProcess, done, aggregatedData, ['parse-server running on']);
|
||||
handleStderr(childProcess, done);
|
||||
handleError(childProcess, done);
|
||||
});
|
||||
|
||||
it('should start Parse Server with GraphQL', async done => {
|
||||
const env = { ...process.env };
|
||||
env.NODE_OPTIONS = '--dns-result-order=ipv4first';
|
||||
env.NODE_OPTIONS = '--dns-result-order=ipv4first --trace-deprecation';
|
||||
childProcess = spawn(
|
||||
binPath,
|
||||
[
|
||||
@@ -255,23 +279,17 @@ describe('execution', () => {
|
||||
],
|
||||
{ env }
|
||||
);
|
||||
let output = '';
|
||||
childProcess.stdout.on('data', data => {
|
||||
data = data.toString();
|
||||
output += data;
|
||||
if (data.includes('GraphQL running on')) {
|
||||
expect(output).toMatch('parse-server running on');
|
||||
done();
|
||||
}
|
||||
});
|
||||
childProcess.stderr.on('data', data => {
|
||||
done.fail(data.toString());
|
||||
});
|
||||
handleStdout(childProcess, done, aggregatedData, [
|
||||
'parse-server running on',
|
||||
'GraphQL running on',
|
||||
]);
|
||||
handleStderr(childProcess, done);
|
||||
handleError(childProcess, done);
|
||||
});
|
||||
|
||||
it('should start Parse Server with GraphQL and Playground', async done => {
|
||||
const env = { ...process.env };
|
||||
env.NODE_OPTIONS = '--dns-result-order=ipv4first';
|
||||
env.NODE_OPTIONS = '--dns-result-order=ipv4first --trace-deprecation';
|
||||
childProcess = spawn(
|
||||
binPath,
|
||||
[
|
||||
@@ -288,38 +306,25 @@ describe('execution', () => {
|
||||
],
|
||||
{ env }
|
||||
);
|
||||
let output = '';
|
||||
childProcess.stdout.on('data', data => {
|
||||
data = data.toString();
|
||||
output += data;
|
||||
if (data.includes('Playground running on')) {
|
||||
expect(output).toMatch('GraphQL running on');
|
||||
expect(output).toMatch('parse-server running on');
|
||||
done();
|
||||
}
|
||||
});
|
||||
childProcess.stderr.on('data', data => {
|
||||
done.fail(data.toString());
|
||||
});
|
||||
handleStdout(childProcess, done, aggregatedData, [
|
||||
'parse-server running on',
|
||||
'Playground running on',
|
||||
'GraphQL running on',
|
||||
]);
|
||||
handleStderr(childProcess, done);
|
||||
handleError(childProcess, done);
|
||||
});
|
||||
|
||||
it('can start Parse Server with auth via CLI', done => {
|
||||
const env = { ...process.env };
|
||||
env.NODE_OPTIONS = '--dns-result-order=ipv4first';
|
||||
env.NODE_OPTIONS = '--dns-result-order=ipv4first --trace-deprecation';
|
||||
childProcess = spawn(
|
||||
binPath,
|
||||
['--databaseURI', databaseURI, './spec/configs/CLIConfigAuth.json'],
|
||||
{ env }
|
||||
);
|
||||
childProcess.stdout.on('data', data => {
|
||||
data = data.toString();
|
||||
if (data.includes('parse-server running on')) {
|
||||
done();
|
||||
}
|
||||
});
|
||||
childProcess.stderr.on('data', data => {
|
||||
data = data.toString();
|
||||
done.fail(data.toString());
|
||||
});
|
||||
handleStdout(childProcess, done, aggregatedData, ['parse-server running on']);
|
||||
handleStderr(childProcess, done);
|
||||
handleError(childProcess, done);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user