test: use tmpdir.refresh() in test-esm-json.mjs

Use `tmpdir.refresh()` in `test/es-module/test-esm-json.mjs` so that
the temporary directory is removed when the test exits.

PR-URL: https://github.com/nodejs/node/pull/51205
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
This commit is contained in:
Luigi Pinca authored and GitHub committed 2023-12-20 17:47:39 +00:00
1 parent 12fc7cb18c
commit 0390a1de66
1 file changed
+3 -1
+3 -1
View File
@@ -2,7 +2,7 @@ import { spawnPromisified } from '../common/index.mjs';
import * as fixtures from '../common/fixtures.mjs';
import assert from 'node:assert';
import { execPath } from 'node:process';
import { describe, it, test } from 'node:test';
import { before, describe, it, test } from 'node:test';
import { mkdir, rm, writeFile } from 'node:fs/promises';
import * as tmpdir from '../common/tmpdir.js';
@@ -10,6 +10,8 @@ import * as tmpdir from '../common/tmpdir.js';
import secret from '../fixtures/experimental.json' with { type: 'json' };
describe('ESM: importing JSON', () => {
before(() => tmpdir.refresh());
it('should load JSON', () => {
assert.strictEqual(secret.ofLife, 42);
});