From 06c14d7451b4366ac5dd8b1e9a1b3e31c84ff91e Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Mon, 18 Dec 2023 15:59:16 +0100 Subject: [PATCH] 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. --- 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); });