mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Suppress deprecations in BufferedNodeProcess
This keeps it consistent with the render process which also suppresses deprecations Closes #5383
This commit is contained in:
39
spec/buffered-node-process-spec.coffee
Normal file
39
spec/buffered-node-process-spec.coffee
Normal file
@@ -0,0 +1,39 @@
|
||||
path = require 'path'
|
||||
BufferedNodeProcess = require '../src/buffered-node-process'
|
||||
|
||||
describe "BufferedNodeProcess", ->
|
||||
it "executes the script in a new process", ->
|
||||
exit = jasmine.createSpy('exitCallback')
|
||||
output = ''
|
||||
stdout = (lines) -> output += lines
|
||||
error = ''
|
||||
stderr = (lines) -> error += lines
|
||||
args = ['hi']
|
||||
command = path.join(__dirname, 'fixtures', 'script.js')
|
||||
|
||||
new BufferedNodeProcess({command, args, stdout, stderr, exit})
|
||||
|
||||
waitsFor ->
|
||||
exit.callCount is 1
|
||||
|
||||
runs ->
|
||||
expect(output).toBe 'hi'
|
||||
expect(error).toBe ''
|
||||
expect(args).toEqual ['hi']
|
||||
|
||||
it "suppresses deprecations in the new process", ->
|
||||
exit = jasmine.createSpy('exitCallback')
|
||||
output = ''
|
||||
stdout = (lines) -> output += lines
|
||||
error = ''
|
||||
stderr = (lines) -> error += lines
|
||||
command = path.join(__dirname, 'fixtures', 'script-with-deprecations.js')
|
||||
|
||||
new BufferedNodeProcess({command, stdout, stderr, exit})
|
||||
|
||||
waitsFor ->
|
||||
exit.callCount is 1
|
||||
|
||||
runs ->
|
||||
expect(output).toBe 'hi'
|
||||
expect(error).toBe ''
|
||||
2
spec/fixtures/script-with-deprecations.js
vendored
Normal file
2
spec/fixtures/script-with-deprecations.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
require('fs').existsSync('hi');
|
||||
process.stdout.write('hi');
|
||||
1
spec/fixtures/script.js
vendored
Normal file
1
spec/fixtures/script.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
process.stdout.write(process.argv[2]);
|
||||
@@ -48,5 +48,8 @@ class BufferedNodeProcess extends BufferedProcess
|
||||
options.env ?= Object.create(process.env)
|
||||
options.env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'] = 1
|
||||
|
||||
args = args?.slice() ? []
|
||||
args.unshift(command)
|
||||
args.unshift('--no-deprecation')
|
||||
|
||||
super({command: node, args, options, stdout, stderr, exit})
|
||||
|
||||
Reference in New Issue
Block a user