From 7e9a0b192a556dccfd1545469120edcfca73eb26 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Wed, 20 Dec 2023 18:47:39 +0100 Subject: [PATCH] test: use tmpdir.refresh() in test-esm-json.mjs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Debadree Chatterjee --- test/es-module/test-esm-json.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/es-module/test-esm-json.mjs b/test/es-module/test-esm-json.mjs index 422a8f717594ab..8be7b60d322573 100644 --- a/test/es-module/test-esm-json.mjs +++ b/test/es-module/test-esm-json.mjs @@ -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); });