Class: Node::Compiler::Test

Inherits:
Object
  • Object
show all
Defined in:
lib/node/compiler/test.rb

Instance Method Summary collapse

Constructor Details

#initialize(tmpdir, options = {}) ⇒ Test

Returns a new instance of Test.



15
16
17
18
19
# File 'lib/node/compiler/test.rb', line 15

def initialize(tmpdir, options = {})
  Utils.prepare_tmpdir(tmpdir)
  @vendor_node = File.join(tmpdir, 'node')
  @options = options
end

Instance Method Details

#run!Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/node/compiler/test.rb', line 21

def run!
  Utils.chdir(@vendor_node) do
    Utils.inject_memfs(File.expand_path('./test/fixtures', @vendor_node), @vendor_node)
    STDERR.puts "-> FileUtils.rm_f(#{Gem.win_platform? ? 'Release\\node.exe' : 'out/Release/node'})"
    FileUtils.rm_f(Gem.win_platform? ? 'Release\\node.exe' : 'out/Release/node')
    File.open(File.expand_path('./lib/enclose_io_entrance.js', @vendor_node), "w") { |f| f.puts 'module.exports = false;' }
    test_env = {
                 'FLAKY_TESTS_MODE' => 'dontcare',
                 'FLAKY_TESTS' => 'dontcare',
                 'ENCLOSE_IO_USE_ORIGINAL_NODE' => '1',
                 'ENCLOSE_IO_ALWAYS_USE_ORIGINAL_NODE' => '1',
               }
    if Gem.win_platform?
      Utils.run(test_env, 'call vcbuild.bat nosign test-ci ignore-flaky')
    else
      Utils.run("./configure")
      Utils.run("make")
      Utils.run(test_env, "make test-ci")
    end
  end
end