Skip to content

test: use tmpdir.refresh() in test-esm-windows.js

Rodrigo Muino Tomonari requested to merge github/fork/richardlau/tmpdir into master

Use tmpdir.refresh() in test/es-module/test-esm-windows.js so that the temporary directory is cleaned before use and when the test exits.

The existing test can otherwise fail if the temporary directory is polluted before running the test:

-bash-4.2$ mkdir -p test/.tmp.0/node_modules
-bash-4.2$ ./tools/test.py es-module/test-esm-windows
=== release test-esm-windows ===
Path: es-module/test-esm-windows
(node:81631) ExperimentalWarning: The ESM module loader is experimental.
/home/users/riclau/sandbox/github/nodejs/test/common/index.js:685
const crashOnUnhandledRejection = (err) => { throw err; };
                                             ^

[Error: EEXIST: file already exists, mkdir '/home/users/riclau/sandbox/github/nodejs/test/.tmp.0/node_modules'] {
  errno: -17,
  code: 'EEXIST',
  syscall: 'mkdir',
  path: '/home/users/riclau/sandbox/github/nodejs/test/.tmp.0/node_modules'
}
Command: out/Release/node /home/users/riclau/sandbox/github/nodejs/test/es-module/test-esm-windows.js
[00:00|% 100|+   0|-   1]: Done
-bash-4.2$

and has been observed failing on the CI: https://ci.nodejs.org/job/node-test-commit-arm/28228/nodes=centos7-arm64-gcc6/consoleFull

16:33:34 not ok 48 es-module/test-esm-windows
16:33:34   ---
16:33:34   duration_ms: 0.411
16:33:34   severity: fail
16:33:34   exitcode: 1
16:33:34   stack: |-
16:33:34     (node:55274) ExperimentalWarning: The ESM module loader is experimental.
16:33:34     /home/iojs/build/workspace/node-test-commit-arm/nodes/centos7-arm64-gcc6/test/common/index.js:704
16:33:34     const crashOnUnhandledRejection = (err) => { throw err; };
16:33:34                                                  ^
16:33:34     
16:33:34     [Error: EEXIST: file already exists, mkdir '/home/iojs/node-tmp/.tmp.1/node_modules'] {
16:33:34       errno: -17,
16:33:34       code: 'EEXIST',
16:33:34       syscall: 'mkdir',
16:33:34       path: '/home/iojs/node-tmp/.tmp.1/node_modules'
16:33:34     }
16:33:34   ...
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading