Process.send is not a function when npm run scripts are used

Viewed 1237

When I spawn a child process as below, process.send inside the executed node file is undefined.

spawn("npm", ["run", "test"], {
        cwd: testPath,
        stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
        env: {
            ...process.env, 
            ...env
        }
 });

whereas if I execute the node file directly as below without using npm run scripts, process.send works fine. Is it possible to use it along with run scripts?

spawn("node", ["testrunner.js"], {
        cwd: testPath,
        stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
        env: {
            ...process.env, 
            ...env
        }
 });
0 Answers
Related