fix: use dynamic import in tests to prevent ESM hoisting race (#429)
f018c1e · peter madsen-mygdal · 2026-03-13 23:45
Message
{commit_body(@commit)}
Files changed
modified
test/setup-beam.test.js
+11
−10
@@ -1,3 +1,13 @@
| 1 | +import assert from 'node:assert' | |
| 2 | +import http from 'node:http' | |
| 3 | +import fs from 'node:fs' | |
| 4 | +import os from 'node:os' | |
| 5 | +import path from 'node:path' | |
| 6 | +import { describe, it } from 'node:test' | |
| 7 | +import * as csv from 'csv-parse/sync' | |
| 8 | +import elixirMatchers from '../matchers/elixir-matchers.json' with { type: 'json' } | |
| 9 | +const { problemMatcher } = elixirMatchers | |
| 10 | + | |
| 1 | 11 | process.env.NODE_ENV = 'test' |
| 2 | 12 | |
| 3 | 13 | simulateInput('otp-version', '25.1.2') |
@@ -9,16 +19,7 @@ simulateInput('install-hex', 'true')
| 9 | 19 | simulateInput('github-token', process.env.GITHUB_TOKEN) |
| 10 | 20 | simulateInput('hexpm-mirrors', 'https://builds.hex.pm', { multiline: true }) |
| 11 | 21 | |
| 12 | −import assert from 'node:assert' | |
| 13 | −import http from 'node:http' | |
| 14 | −import fs from 'node:fs' | |
| 15 | −import os from 'node:os' | |
| 16 | −import path from 'node:path' | |
| 17 | −import { describe, it } from 'node:test' | |
| 18 | −import * as csv from 'csv-parse/sync' | |
| 19 | −import setupBeam from '../src/setup-beam.js' | |
| 20 | −import elixirMatchers from '../matchers/elixir-matchers.json' with { type: 'json' } | |
| 21 | −const { problemMatcher } = elixirMatchers | |
| 22 | +const { default: setupBeam } = await import('../src/setup-beam.js') | |
| 22 | 23 | |
| 23 | 24 | const matrix = { |
| 24 | 25 | otp: { |
Parents: d843ebb