Skip to content

Commit

Permalink
test: use tmpdir.refresh() in test-esm-json.mjs
Browse files Browse the repository at this point in the history
Use `tmpdir.refresh()` in `test/es-module/test-esm-json.mjs` so that
the temporary directory is removed when the test exits.

PR-URL: #51205
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Debadree Chatterjee <[email protected]>
  • Loading branch information
lpinca authored and RafaelGSS committed Jan 2, 2024
1 parent 3759491 commit 7e9a0b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/es-module/test-esm-json.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ 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';

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);
});
Expand Down

0 comments on commit 7e9a0b1

Please sign in to comment.