Test that pyodide package.json version matches fetch script

GitOrigin-RevId: e04ae191d2b1e5a08ba2e27518e61899d0e2d490
This commit is contained in:
Domagoj Kriskovic
2026-05-06 12:48:29 +02:00
committed by Copybot
parent 5d171066c2
commit 11d35bd065
@@ -0,0 +1,32 @@
import { readFile } from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const SERVICE_WEB_DIR = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'../../../..'
)
describe('fetch-pyodide-packages.mjs', function () {
it('PYODIDE_VERSION matches the pyodide dependency in package.json', async function () {
const packageJson = JSON.parse(
await readFile(path.join(SERVICE_WEB_DIR, 'package.json'), 'utf8')
)
const scriptSource = await readFile(
path.join(SERVICE_WEB_DIR, 'scripts/fetch-pyodide-packages.mjs'),
'utf8'
)
const match = scriptSource.match(/PYODIDE_VERSION\s*=\s*'([^']+)'/)
expect(match, 'PYODIDE_VERSION constant not found in fetch script').to.not
.be.null
const scriptVersion = match[1]
const packageVersion =
packageJson.dependencies?.pyodide ?? packageJson.devDependencies?.pyodide
expect(scriptVersion).to.equal(
packageVersion,
'PYODIDE_VERSION in scripts/fetch-pyodide-packages.mjs must match the pyodide version in package.json; bump both together.'
)
})
})